Question: *write sql query for these problem. Consider the following relations containing ridesharing information. Create Three tables described below. Name these tables as RIDERS, PASSENGERS, and

 *write sql query for these problem. Consider the following relations containingridesharing information. Create Three tables described below. Name these tables as RIDERS,PASSENGERS, and RIDES_TODAY. The underlined fields are the primary keys of theirrespective tables. RIDER(rdr_id: int, name: varchar, vehicle: varchar, vtype: varchar, join_date: date,total_rides:int, income: decimal, distance: decimal) PASSENGERS(pid: int, pname: varchar, join_date:date) RIDES_TODAY(rd_id: int,

*write sql query for these problem.

Consider the following relations containing ridesharing information. Create Three tables described below. Name these tables as RIDERS, PASSENGERS, and RIDES_TODAY. The underlined fields are the primary keys of their respective tables. RIDER(rdr_id: int, name: varchar, vehicle: varchar, vtype: varchar, join_date: date, total_rides:int, income: decimal, distance: decimal) PASSENGERS(pid: int, pname: varchar, join_date:date) RIDES_TODAY(rd_id: int, rdr_id: int, pid: int, distance: decimal, bill: decimal) TABEL: RIDER rdr_id rname vehicle vtype join_date total_rides income distance 1 Abrar Fahim Honda Civic 20-03-2020 75 87000 1200 N Jafar Ahmed Yamaha R15 B 12-01-2020 55 60000 900 3 Jannatul Lamia Toyota Prius 04-04-2020 30 33000 350 4 Tanvir Ahmed Yamaha Pulsar B 01-12-2019 105 100000 1370 5 Shahriar Alam Bajaj Discover B 25-01-2020 5 1000 80 6 6 Ashfaq Nabid UM Sport B 28-09-2020 1 350 22 7 SM Sayem Toyota Corolla 08-08-2020 15 5200 190 00 Golam Haider Vespa B 16-03-2020 45 52000 650 TABEL: PASSENGERS pid pname join_date 1 Shahriar Chowdhury 02-01-2020 N Jamal E Mollah 21-10-2019 3 Alvi Hossain 12-11-2019 4 Tonmoy Jaman 27-01-2020 5 Toukir Munshi 02-12-2019 6 Yakub Noby 24-12-2019 7 Mithila Rahman 27-02-2020 8 Jobbar Sheikh 14-03-2020 9 Chunnu Wahidul 07-06-2020 10 Rakib Hasan 29-08-2020 TABEL: RIDES TODAY rd_id rdr_id pid distance bill 1 1 7 14.3 480 N 2 10 1.3 40 3 4 2 8.9 110 4 5 4 15.5 260 5 7 3 5.1 250 6 1 7 14.3 510 7 1 1 9.5 330 8 7 6 5.5 280 9 8 10 8.2 140 10 4 8 5.7 90 11 N 2 3.4 90 12 8 6 12.5 165 13 4 8 15.6 250 14 3 6 8.5 290 15 4 2 5.1 70 Questions 1. [3 Points] Create all the tables and populate them with the given data. [Don't need explanation] 2. [3 Points] Show the descriptions and contents of all the tables. [Don't need explanation] 3. [6 Points] Show the list of passengers who didn't ride today. 4. [6 Points] Show all the details of today's rides with all the riders' relevant information and all the passengers' relevant information. 5. [6 Points] How much revenue came today from cars. 6. [6 Points] Find all the cars with its rider name who drove the longest road today. 7. [6 Points) Find the name of the bike riders who drove less than 5 km. 8. [6 Points] Find out how much each passenger paid today. 9. [2 Points] Add new column in named plevel in PASSENGERS table with int datatype. [Don't need explanation] 10. [6 Points] Update the PASSENGERS table's level column using the following conditions. All the rows should be updated upon executing the query once. a. If join_date is before 01-01-2020 then level = 3 b. If join_date is before 01-07-2020 then level = 2 c. Else level = 1 11. [8 Points) Create a trigger for inserting new rows in the PASSENGERS table. The trigger will insert levels based on the join_date. 12. [4 Points] Create a stored procedure that will return the total amount of bill each rider earned today. Execute the procedure. 13. [6 Points] Show the name of the car riders with his passenger name, traveled distance, and bill who completed a single ride today. 14. [6 Points] Show the name of all bike riders with their today's total income. 15. [6 Points] Show the details of today's rides with the riders' relevant information and passengers' relevant information about who went for the ride today

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!