SQL Basics
Keys & Relationships
Constraints, Indexes, & Data Types
Queries & Joins
Design
100

This query would retrieve all columns and rows from the Employees table.

What is SELECT * FROM Employees;

100

This uniquely identifies each record in a table and by default is the clustered index on a table.

What is the primary key?

100

This constraint automatically assigns a preset value when none is provided.

What is the DEFAULT constraint?

100

This JOIN returns only rows that have matching values in both tables.

What is an INNER JOIN?
100

This is the practice of organizing data to eliminate redundancy and improve consistency.

What is normalization?

200

This clause can be used to filter records returned by an SQL query and is commonly used in SELECT, UPDATE, and DELETE commands.

What is the WHERE clause?

200

These are the possible ways to relate tables to one another.

What are one to one, one to many, and many to many relationships?

200

This constraint generates a unique value, increasing for each new row.

What is an IDENTITY (or AUTO_INCREMENT) constraint?

200

This JOIN could return all customers, even if they had no orders placed.

What is a LEFT JOIN?

200

This could occur when a query/table lacks an appropriate index while filtering rows, resulting in a very slow response time.

What is a table scan?

300

This clause combines identical column values into summary rows. For example, getting the count of ski models for each ski brand.

What is the GROUP BY clause?

300

This type of key combines multiple columns to unique identify a record.

What is a composite key?

300

This data type would be great to derive a user's age from.

What is a DATE or DATETIME?

300

This virtual table is great for simplifying complex queries and can help us to secure sensitive data.

What is a view?

300

This design principle ensures each column stores only one piece of information. Bonus: It is the first step in _____.

What is atomicity and First Normal Form?

400
This clause occurs after the aggregation phase, allowing you to filter based on aggregations like AVG(), SUM(), and COUNT().

What is the HAVING clause?

400

This will automatically delete dependent rows when a parent is deleted.

What is ON DELETE CASCADE?
400

This would be great to add to a table if we need to retrieve data quicker. However, you should consider the downsides, which are: ____.

What are an index and slower data modifications?

400

The CEO of your company decided to learn SQL and angrily demands to know why their database is broken because some customers are not coming back in their query:

SELECT c.CustomerName, o.OrderID

FROM Customers c

JOIN Orders o ON c.CustomerID = o.CustomerID

WHERE o.OrderDate >= '2025-01-01';

What is using the wrong JOIN type - INNER JOIN wrong, LEFT JOIN correct.

400

This is the form that removes transitive dependencies (non-key columns depend only on the primary key of the table) and is what most databases can strive for.

What is Third Normal Form?

500

This type of query utilizes values from its parent query and will run for each row returned from the parent query.

What is a correlated subquery?

500

This type of relationship must be defined using this type of table.

What are many to many relationships and an associative table?

500

_____ determines the physical row order for a table, and _____ is a separate ordered structure pointing to our data, generally stored in a ________.

What is a clustered index, a non clustered index, and a B (Binary) Tree?

500

This query will show us these departments:

SELECT d.DepartmentName

FROM Departments d

LEFT JOIN Employees e ON d.DepartmentID = e.DepartmentID

WHERE e.EmployeeID IS NULL;

What are departments with no employees?

500

A database design that supports historical tracking of data changes. (Product A was priced at $10 between these dates, at $12 between other dates, etc.)

What is a temporal database/What are temporal attributes?