Create a query that returns School Name, School Dean Last Name, School Dean First Name, Department Name, Department Chair Last Name, and Department Chair First Name. Sort by School Name and Department Name.

Respuesta :

abarde

Answer:

SELECT  School_name,School Dean Last Name, School Dean First Name,Department Name, Department Chair Last Name, Department Chair First Name

FROM table_name

ORDER BY School Name,Department Name

nooray

Answer:

SELECT School_Name, School_DeanLastName, School_DeanFirstName, Department_Name, Department_ChairLastName, Department_ChairFirstName

FROM (School INNER JOIN Department ON School.School_ID = Department.School_ID);  

ORDER BY School.SName ASC, Department.Name DESC;

Explanation: SQL Query

Inner join: The inner join keyword selects records that have matching values in both tables. It also avoid repetition of data.

After SELECT keyword, we use tablename.columnName

ORDER BY: Use to sort data on the base of some condition. Here we assume that School_Id is the primary key in table School and foreign key in the table Department.  

ASC: Used to sort in ascending order.

DESC: used to sort in descending order.

Happy Coding :)

ACCESS MORE