Question SQL problem. I have a database table called Booking. There are 4 fields in it: booking_id, date, time, and doctor_id and booking_id is the primary key. The doctor_id is the primary key of the Doctor table. Now I am want to List out the booking record in the Booking table, and group by date, time and doctor_id together. It should count how many booking is happening for the same date, same time and same doctor_id. For example: The booking record have 3 items booking_id date time doctor_id 1 2020-4-27 5:45 1 2 2020-4-27 5:45 1 3 2020-4-26 5:45 3 I expect the output date time waiting_number 2020-4-27 5:45 2 2020-4-26 5:45 1

6OLRNU The Asker · Computer Science

SQL problem.

I have a database table called Booking. There are 4 fields in it: booking_id, date, time, and doctor_id and booking_id is the primary key.

The doctor_id is the primary key of the Doctor table.

Now I am want to List out the booking record in the Booking table, and group by date, time and doctor_id together. It should count how many booking is happening for the same date, same time and same doctor_id.

For example:

The booking record have 3 items

booking_id date time doctor_id
1 2020-4-27 5:45 1
2 2020-4-27 5:45 1
3 2020-4-26 5:45 3

I expect the output

date time waiting_number
2020-4-27 5:45 2
2020-4-26 5:45 1

More