You are on page 1of 2

1. Write a SQL statement to display Students' First and Last Name. SELECT Student.First_Name, Student.Last_Name FROM Student; 2.

Write a SQL statement to display the Major of students with no duplications. Do not display student names. SELECT DISTINCT Student.Major FROM Student; 3. Write a SQL statement to display the First and Last Name of students who live in the Zip code 88888. SELECT Student.First_Name, Student.Last_Name, Student.Zip FROM Student WHERE Student.Zip="88888"; 4. Write a SQL statement to display the First and Last Name of students who live in the Zip code 88888 and have the major of Biology. SELECT Student.First_Name, Student.Last_Name, Student.Zip, Student.Major FROM Student, Course WHERE (((Student.Zip)="88888") AND ((Student.Major)="Biology")); 5. Write a SQL statement to display the First and Last Name of students who live in the Zip code 88888 or 88808. Do not use IN. SELECT Student.First_Name, Student.Last_Name, Student.Zip FROM Student WHERE Student.Zip="88888" OR Student.Zip="88808"; 6. Write a SQL statement to display the First and Last Name of students who have the major of Biology or Math. Use the SQL command IN. SELECT Student.First_Name, Student.Last_Name, Student.Major FROM Student WHERE Student.Major IN ("Biology" , "Math"); 7. Write a SQL statement to display the First and Last Name of students who have the Status greater than 1 and less than 10. Use the SQL command BETWEEN. SELECT Student.First_Name, Student.Last_Name FROM Student WHERE Student.Status Between 1 And 10;

8. Write a SQL statement to display the First and Last Name of students who have a last name that starts with an S. SELECT Student.First_Name, Student.Last_Name FROM Student WHERE Student.Status Between 1 And 10; 9. Write a SQL statement to display the First and Last Name of students having an a in the second position in their first names. SELECT Student.First_Name, Student.Last_Name FROM Student WHERE Student.First_Name Like '_a%'; 10. Write a SQL expression to display the Status and a sum of the Status of each Status value as SumOfStatus. Group by Status and display the results in descending order of SumOfStatus. SELECT Student.Status, Sum(Student.Status) AS SumOfStatus FROM Student GROUP BY Student.Status ORDER BY SumOfStatus DESC;

You might also like