SQL Tutorial menu

SQL Quiz

Check what you have learned. All questions use the students and courses tables from this tutorial.

How the Quiz Works

Choose an answer for each question. The explanation tells you why it is right. If you miss one, go back to that lesson and try the examples again.

idnamecityagemarkscourse_id
1Ali KhanKarachi19781
2Ayesha SiddiquiLahore21852
3Bilal AhmedKarachi22641
4Fatima NoorIslamabad20923
5Hamza RazaKarachi1870NULL
6Sana IqbalLahore23882

Question 1

Exercise

Which keyword reads data from a table?

Question 2

Exercise

How many rows does this return? SELECT name FROM students WHERE city = 'Karachi';

Question 3

Exercise

Which query shows the highest marks first?

Question 4

Exercise

What does SELECT AVG(marks) FROM students; return?

Question 5

Exercise

Which statement changes Ali Khan's marks to 80?

Question 6

Exercise

Which condition matches ages 19, 20 and 21?

Question 7

Exercise

An INNER JOIN between students and courses on students.course_id = courses.id returns how many rows?

Question 8

Exercise

Which clause filters groups after GROUP BY?

Question 9

Exercise

Which statement removes the whole students table, including its structure?

Question 10

Exercise

Which constraint makes a column both unique and not null, so it can identify each row?

What Next?

Well done on finishing the SQL tutorial. Now practise on a real database: continue with the MySQL tutorial or the PostgreSQL tutorial.

Learn SQL with a teacher

Join the Full Stack Development course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp