Adds notes.

This commit is contained in:
Tanmay
2022-10-06 14:56:52 +01:00
parent f0bbd9a03f
commit a408ec280a
7 changed files with 440 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
# Sub-queries and views worksheet
## Sub-queries
1. Get all the students whose IQ is greater than the average IQ.
```sql
```
2. Get all the students whose IQ is greater than the highest IQ of the batch_id `2` students.
```sql
```
3. Get all the students whose IQ is greater than `all` the IQs of the batch_id `2` students.
```sql
```
4. Find all the students who are in batches that start with the word `Jedi` (Without JOIN)
```sql
```
5. Find all the students whose IQ is greater than the average IQ of their batch.
```sql
```
6. Get all the instructors that have at least one batch (Without using joins)
```sql
```
7. Print all the names, batch ID and average IQ of the batch for each student
```sql
```
## Views
1. Create a view that shows the students and their batches.
```sql
```
2. Create a view that shows the students and their batches, but only for batches that start with the word `Jedi`.
```sql
```