(Use SQL) The Car Maintenance team wants to learn how many times each car is used in every month and day to organize their maintenance schedules. The team wants a table with the following column names and information: Car ID Month Day Count You need to create a summary table using the WITH ROLLUP modifier and grouped by the specific column names, listed above, and send the data back to the team. Task   Query the frequency of each car's use by month and day

icon
Related questions
Question

(Use SQL) The Car Maintenance team wants to learn how many times each car is used in every month and day to organize their maintenance schedules. The team wants a table with the following column names and information:

  • Car ID
  • Month
  • Day
  • Count

You need to create a summary table using the WITH ROLLUP modifier and grouped by the specific column names, listed above, and send the data back to the team.

Task
 

Query the frequency of each car's use by month and day

TRAVEL_ID
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
TRAVEL_START_TIME
2019-10-01 04:04:55
2019-10-01 05:57:33
2019-10-01 13:35:20
2019-10-02 08:44:48
2019-10-02 16:38:54
2019-10-03 19:12:14
2019-10-03 16:06:36
2019-10-03 17:17:12
2019-10-03 21:16:48
2019-10-03 23:21:40
TRAVEL_END_TIME
2019-10-01 04:14:19
2019-10-01 06:12:33
2019-10-01 13:45:10
2019-10-02 09:15:28
2019-10-02 16:48:10
2019-10-03 19:23:45
2019-10-03 16:08:56
2019-10-03 17:37:42
2019-10-03 21:26:18
2019-10-03 23:39:10
TRAVEL_START_LOCATION
9614 York Road
47 Church Street
2 Windsor Road
9060 Mill Lane
2 Queensway
50 Main Road
39 Park Road
37 The Drive
77 Mill Road
16 Church Road
TRAVEL_END_LOCATION
84 Church Lane
68 High Street
95 West Street
27 Main Road
24 Mill Lane
93 Broadway
91 West Street
17 Stanley Road
724 Springfield Road
30 North Road
TRAVEL_PRICE
15.44
20.56
12.32
30.49
11.15
14.61
4.41
25.12
13.55
25.62
DRIVER_ID
2001
2001
2002
2003
2001
2003
2002
2001
2001
2003
CAR_ID USER_ID
1003
1003
1001
1002
1003
1002
1004
1003
1003
1002
3005
3006
3002
3001
3007
3007
3003
3001
3005
3003
TRAVEL_DISCOU
NULL
NULL
NULL
0.13
NULL
0.10
0.14
0.25
NULL
0.20
Transcribed Image Text:TRAVEL_ID 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 TRAVEL_START_TIME 2019-10-01 04:04:55 2019-10-01 05:57:33 2019-10-01 13:35:20 2019-10-02 08:44:48 2019-10-02 16:38:54 2019-10-03 19:12:14 2019-10-03 16:06:36 2019-10-03 17:17:12 2019-10-03 21:16:48 2019-10-03 23:21:40 TRAVEL_END_TIME 2019-10-01 04:14:19 2019-10-01 06:12:33 2019-10-01 13:45:10 2019-10-02 09:15:28 2019-10-02 16:48:10 2019-10-03 19:23:45 2019-10-03 16:08:56 2019-10-03 17:37:42 2019-10-03 21:26:18 2019-10-03 23:39:10 TRAVEL_START_LOCATION 9614 York Road 47 Church Street 2 Windsor Road 9060 Mill Lane 2 Queensway 50 Main Road 39 Park Road 37 The Drive 77 Mill Road 16 Church Road TRAVEL_END_LOCATION 84 Church Lane 68 High Street 95 West Street 27 Main Road 24 Mill Lane 93 Broadway 91 West Street 17 Stanley Road 724 Springfield Road 30 North Road TRAVEL_PRICE 15.44 20.56 12.32 30.49 11.15 14.61 4.41 25.12 13.55 25.62 DRIVER_ID 2001 2001 2002 2003 2001 2003 2002 2001 2001 2003 CAR_ID USER_ID 1003 1003 1001 1002 1003 1002 1004 1003 1003 1002 3005 3006 3002 3001 3007 3007 3003 3001 3005 3003 TRAVEL_DISCOU NULL NULL NULL 0.13 NULL 0.10 0.14 0.25 NULL 0.20
CAR_ID
1001
1002
1003
1004
CAR_PLATE
BB-542-AB
BB-883-EE
BB-451-ZN
BB-189-MM
CAR_MODEL
TOYOTA PRIUS
TESLA MODEL 3
TOYOTA AURIS
MERCEDES E200
CAR_YEAR
2018
2019
2019
2019
Transcribed Image Text:CAR_ID 1001 1002 1003 1004 CAR_PLATE BB-542-AB BB-883-EE BB-451-ZN BB-189-MM CAR_MODEL TOYOTA PRIUS TESLA MODEL 3 TOYOTA AURIS MERCEDES E200 CAR_YEAR 2018 2019 2019 2019
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 2 images

Blurred answer