Question: Create SQL queries (postgreSQL), the entities could be change if necessary or it makes the queries easier to be implemented: List all instructors who has
Create SQL queries (postgreSQL), the entities could be change if necessary or it makes the queries easier to be implemented:
- List all instructors who has given more than a specific number of lessons during the current month.
- Sum all lessons, independent of type.
- Also list the three instructors having given most lessons (independent of lesson type) during the last month, sorted by number of given lessons.
- The queries will be used to find instructors risking to work too much, and will be executed daily.
The following query should be performed programmatically:
- List all ensembles held during the next week, sorted by music genre and weekday. For each ensemble tell whether it's full booked, has 1-2 seats left or has more seats left.

individual_lesson individual_lesson_id SERIAL NOT NULL student_id SERIAL NOT NULL (FK) in strument VARCHAR (100) level VARCHAR (100) start_time TIMESTAMP (10) end_time TIMESTAMP (10) employment_id SERIAL NOT NULL (FK) group_lesson group_lesson_id SERIAL NOT NULL nr_of_places INT min_nr_of_student INT instrument VARCHAR (100) level VARCHAR (10) start_time TIMESTAMP (10) end_time TIMESTAMP (10) employment_id SERIAL NOT NULL (FK) couldBe ensemble group_lesson_id SERIAL NOT NULL (FK) teaches teaches genre VARCHAR (100) TT instructor VARCHAR (100) instructor Hemployment_id SERIAL NOT NULL VARCHAR (9) NOT NULL (FK) ssh individual_lesson individual_lesson_id SERIAL NOT NULL student_id SERIAL NOT NULL (FK) in strument VARCHAR (100) level VARCHAR (100) start_time TIMESTAMP (10) end_time TIMESTAMP (10) employment_id SERIAL NOT NULL (FK) group_lesson group_lesson_id SERIAL NOT NULL nr_of_places INT min_nr_of_student INT instrument VARCHAR (100) level VARCHAR (10) start_time TIMESTAMP (10) end_time TIMESTAMP (10) employment_id SERIAL NOT NULL (FK) couldBe ensemble group_lesson_id SERIAL NOT NULL (FK) teaches teaches genre VARCHAR (100) TT instructor VARCHAR (100) instructor Hemployment_id SERIAL NOT NULL VARCHAR (9) NOT NULL (FK) ssh
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
