Answer :
Answer:
i) To represent the relationships between the tables using foreign keys:
In TRIP, the Ssn would be the foreign key, such that Ssn references the SALESPERSON table.
In the EXPENSE table, the foreign key referring to the TRIP table would be TripId.
Explanation
i) To represent the relationships between the tables using foreign keys:
In TRIP, the Ssn would be the foreign key, such that Ssn references the SALESPERSON table.
In the EXPENSE table, the foreign key referring to the TRIP table would be TripId.
Assumptions:
What makes the SALESPERSON so unique is that it can go through more than one travel.
The TRIP can have many of the records of EXPENSE based on the trip in the table EXPENSE.
ii) For the information on the salespersons who have traveled between Mumbai and Delhi with travel expenses of more than Rs. 50000:
σ(FromCity='Mumbai' ∧ ToCity='Delhi' ∧ Amount > 50000) (SALESPERSON ⨝ TRIP ⨝ EXPENSE)
iii) To get the details of the salesperson who incurred the greatest travel expenses:
π(Ssn, Name, MAX(Amount)) (SALESPERSON ⨝ TRIP ⨝ EXPENSE)
iv) To list the salespersons who have not been on any trips:
π(Ssn, Name) (SALESPERSON - (σ(Ssn=TRIP.Ssn) (SALESPERSON ⨝ TRIP)))
v) To find the total number of trips made by each salesperson:
γ(Ssn, COUNT(TripId) as TotalTrips) (TRIP) ⨝ SALESPERSON