Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SELECT LessonSchedule.LessonDateTime, Horse.RegisteredName, Horse.Breed, Horse.Height, Student.FirstName, Student.LastName FROM LessonSchedule LEFT JOIN Horse ON LessonSchedule.HorseID = Horse.ID LEFT JOIN Student ON LessonSchedule.StudentID = Student.ID WHERE LessonSchedule.LessonDateTime
SELECT LessonSchedule.LessonDateTime, Horse.RegisteredName, Horse.Breed, Horse.Height, Student.FirstName, Student.LastName
FROM LessonSchedule
LEFT JOIN Horse ON LessonSchedule.HorseID Horse.ID
LEFT JOIN Student ON LessonSchedule.StudentID Student.ID
WHERE LessonSchedule.LessonDateTime AND LessonSchedule.LessonDateTime
ORDER BY LessonSchedule.LessonDateTime ASC, Horse.RegisteredName ASC; LAB Select lesson schedule with multiple joins
The database has three tables for tracking horseriding lessons:
Horse with columns:
ID primary key
RegisteredName
Breed
Height
BirthDate
Student with columns:
ID primary key
FirstName
LastName
Street
City
State
Zip
Phone
EmailAddress
LessonSchedule with columns:
HorselD partial primary key, foreign key references HorseID
StudentID foreign key references StudentID
LessonDateTime partial primary key
Write a SELECT statement to create a lesson schedule for Feb with the lesson datetime student's first and last names, and the
horse's registered name. Order the results in ascending order by lesson datetime then by the horse's registered name. Make sure
unassigned lesson times student ID is NULL appear in the results.
Hint: Perform a join on the LessonSchedule, Student, and Horse tables, matching the student IDs and horse IDs.
qzqy
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started