Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

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.

Sagot :

SELECT statement are used to retrieve data from a database table

The SELECT statement that creates the lesson schedule is:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule JOIN Student ON LessonSchedule.StudentID = Student.ID ORDER BY LessonDateTime ASC, HorseID

How to determine the SELECT statement

To write the select statement, we start by writing the following query that retrieves Lesson date/time, horse ID, first name, and last name from the lesson schedule table.

So, we have:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule

Next, the query would confirm the presence of a student ID in the lesson schedule table and the student table using the JOIN statement

JOIN Student ON LessonSchedule.StudentID = Student.ID

From the question, we understand that:

The result should be sorted in ascending order by lesson date/time.

This is represented as:

ORDER BY LessonDateTime ASC, HorseID

Hence, the complete query is:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule JOIN Student ON LessonSchedule.StudentID = Student.ID ORDER BY LessonDateTime ASC, HorseID

Read more about database at:

https://brainly.com/question/24223730