Exercise
Find the college of the students who we owe the most money to (have the
most negative balances). Show this only for the top 10 students.
SELECT Students.College FROM Students JOIN Financial ON
Students.Student_ID = Financial.Student_ID ORDER BY Financial.Balance
LIMIT 10 WHERE Financial.Balance < 0;
Find all the Meeting Day, Time pairs
SELECT Meeting_Days, Meeting_Time from Classes;
Find all unique instructor names
SELECT DISTINCT Instructor FROM Classes
SQL
SELECT Last_Name FROM Students
SELECT field name FROM table name
SELECT First_Name, Last_Name FROM Students
SELECT First_Name, Last_Name FROM Students WHERE Degree_Program="MLS"
SELECT * FROM Students
SELECT DISTINCT Degree_Program FROM Students;
SELECT COUNT(Last_Name) FROM Students WHERE Degree_Program = "MLS"
SELECT College, COUNT(Last_Name) FROM Students WHERE Degree_Program =
"PhD" GROUP BY College
SELECT COUNT(DISTINCT Class_Number) FROM Classes;
SELECT First_Name, Last_Name FROM Students JOIN Enrollment ON
Students.Student_ID = Enrollment.Student_Key;
SELECT Students.First_Name, Students.Last_Name, Financial.Street,
Financial.City, Financial.State, Financial.Zip
FROM Students
JOIN Financial
ON Students.Student_ID = Financial.Student_ID
SELECT Students.First_Name, Students.Last_Name, Financial.Street,
Financial.City, Financial.State, Financial.Zip
FROM Students
JOIN Financial
ON Students.Student_ID = Financial.Student_ID
WHERE
Financial.Balance > 0;
SELECT Student_ID FROM Financial ORDER BY Balance DESC;
SELECT Student_ID FROM Financial ORDER BY Balance DESC LIMIT 10;
SELECT Students.First_Name, Students.Last_Name, Financial.Street,
Financial.City, Financial.State, Financial.Zip
FROM Students
JOIN Financial
ON Students.Student_ID = Financial.Student_ID
ORDER BY Balance DESC LIMIT 10;