Skip to content

Latest commit

 

History

History
80 lines (51 loc) · 1.3 KB

06-sql-joins-aggregation-worksheet.md

File metadata and controls

80 lines (51 loc) · 1.3 KB

Queries

Joins

  1. Get all batch names along with their instructor names.
  1. Get all students along with their batch names if present else NULL.
  1. Get all students along with their batch names. Also, fetch all the batches which have no students.
  1. Get all the combinations of batches and instructors.
  1. Get all students with their instructors. If a student has no instructor, then show NULL for the instructor's name.

Aggregation

  1. Get the maximum IQ in all students (Try without aggregation first).
  1. Get the maximum IQ in all students (With aggregation).
  1. Get the oldest batch from the batches table.
  1. Fetch the number of batches that start with the word Jedi.
  1. Get the average IQ of all students (Without using AVG)
  1. Get the average IQ of students in all batches.
  1. Find the average IQ of students in each batch.
  1. Find the total number of students in each batch.
  1. Get the total number of batches taught by each instructor.
  1. Find the average IQ of students in batches with batch ID 1 and 2.
  1. Find count of students that are part of batches that have average IQ greater than 120.