fundamentals/database/notes/09-subqueries-views-worksheet.md
2022-10-06 14:56:52 +01:00

938 B

Sub-queries and views worksheet

Sub-queries

  1. Get all the students whose IQ is greater than the average IQ.

  1. Get all the students whose IQ is greater than the highest IQ of the batch_id 2 students.

  1. Get all the students whose IQ is greater than all the IQs of the batch_id 2 students.

  1. Find all the students who are in batches that start with the word Jedi (Without JOIN)

  1. Find all the students whose IQ is greater than the average IQ of their batch.

  1. Get all the instructors that have at least one batch (Without using joins)

  1. Print all the names, batch ID and average IQ of the batch for each student

Views

  1. Create a view that shows the students and their batches.

  1. Create a view that shows the students and their batches, but only for batches that start with the word Jedi.