ZY Labs Flashcards

1
Q

The Horse table has the following columns:

ID - integer, primary key
RegisteredName - variable-length string
Breed - variable-length string
Height - decimal number
BirthDate - date

Write a SELECT statement to select the registered name and height for only horses that have an above average height. Order the results by height (ascending).

Hint: Use a subquery to find the average height.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The database has three tables for tracking horse-riding lessons:

Write a SELECT statement to create a lesson schedule for Feb 1, 2020 with the lesson date/time, student’s first and last names, and the horse’s registered name. Order the results in ascending order by lesson date/time, then by the horse’s registered name. Make sure unassigned lesson times (student ID is NULL) appear in the results.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write a SELECT statement to create a lesson schedule with the lesson date/time, horse ID, and the student’s first and last names. Order the results in ascending order by lesson date/time, then by horse ID. Unassigned lesson times (student ID is NULL) should not appear in the schedule.

Hint: Perform a join on the Student and LessonSchedule tables, matching the student IDs.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly