SQL for Analysts — Quiz

Answer all 12 questions, then submit. You need 70% to pass. Log in to save progress.

Question 1
Which clause filters individual rows BEFORE grouping?
A HAVING
B WHERE
C ORDER BY
D GROUP BY
Question 2
Which clause filters groups AFTER aggregation (e.g. SUM() > 3000)?
A WHERE
B HAVING
C SELECT
D LIMIT
Question 3
A LEFT JOIN returns…
A only matching rows
B all rows from the left table plus any matches from the right
C all rows from the right table
D every combination
Question 4
An INNER JOIN returns…
A all rows from both tables
B only rows that match in both tables
C the left table only
D no rows
Question 5
What is a CTE?
A A type of index
B A named temporary result defined with WITH
C A chart
D A database backup
Question 6
Window functions differ from GROUP BY because they…
A are slower always
B compute across related rows WITHOUT collapsing them
C only work on text
D cannot rank
Question 7
Which window function gives the previous row's value (for % change)?
A ROW_NUMBER()
B LAG()
C NTILE()
D RANK()
Question 8
In RANK() OVER (PARTITION BY region ORDER BY revenue DESC), PARTITION BY sets…
A the sort order
B the group within which ranking restarts
C the table name
D the column to return
Question 9
Which adds if/then logic inside a query?
A IF FILE
B CASE WHEN ... THEN ... END
C SWITCH
D WHEN ONLY
Question 10
Which replaces NULLs with a default value?
A ISNULL_ONLY()
B COALESCE(col, 0)
C DROP NULL
D NVL_NONE()
Question 11
A good optimisation habit is to…
A always use SELECT *
B select only needed columns and filter early
C avoid indexes
D pull all rows into Python first
Question 12
Which brings a SQL query result directly into a Pandas DataFrame?
A pd.sql()
B pd.read_sql(query, engine)
C engine.to_pandas()
D sql.fetch()