SQL Practical Checklist
Created by Cheli
Step-by-step guide to learn and apply SQL in real-world scenarios.
Please sign in before starting payment and download.
Checklist Items (24)
Select all columns from a table
Use SELECT * FROM table_name; to view every column and row.
Select specific columns
List column names after SELECT to return only needed data, e.g., SELECT first_name, last_name FROM employees;
Use column and table aliases
Assign temporary names with AS for readability, e.g., SELECT e.first_name AS fname FROM employees e;
Filter data with WHERE and sort results
Combine WHERE clauses for filtering and ORDER BY for sorting.
Apply comparison operators (=, <>, >, <, >=, <=)
Filter rows where column values meet specific conditions, e.g., WHERE salary > 50000;
Combine conditions with AND and OR
Use AND to require multiple conditions, OR to satisfy any of them, e.g., WHERE department = 'Sales' AND region = 'North';
Filter ranges with BETWEEN and list values with IN
Use BETWEEN for inclusive ranges, IN for matching any value from a list, e.g., WHERE age BETWEEN 20 AND 30;
Sort results with ORDER BY (ASC/DESC) and multiple columns
Order output ascending or descending, add multiple columns for tie-breaking, e.g., ORDER BY last_name ASC, first_name DESC;
Use aggregate functions COUNT, SUM, AVG, MIN, MAX
Calculate totals, averages, and extremes, e.g., SELECT COUNT(*) AS total_orders FROM orders;
Group by a single column
Aggregate rows sharing the same value in a column, e.g., SELECT department, AVG(salary) FROM employees GROUP BY department;
Group by multiple columns
Create finer groupings, e.g., SELECT department, job_title, AVG(salary) FROM employees GROUP BY department, job_title;
Filter groups with HAVING clause
Apply conditions on aggregated results, e.g., HAVING AVG(salary) > 60000;
Join tables to combine related data
Learn different join types to query data across multiple tables.
Understand inner join concept
Returns rows when there is a match in both tables; the most common join.
Write an INNER JOIN query
Syntax: SELECT columns FROM table1 INNER JOIN table2 ON table1.id = table2.foreign_id;
Write a LEFT (OUTER) JOIN query
Returns all rows from left table and matched rows from right; unmatched right columns are NULL.
Write a RIGHT (OUTER) JOIN query
Returns all rows from right table and matched rows from left; unmatched left columns are NULL.
Join on multiple conditions and use table aliases
Combine several AND conditions in ON clause and alias tables for brevity, e.g., ON a.id = b.a_id AND a.status = 'active';
Modify data and follow best practices
Insert, update, delete data safely and apply performance & security tips.
Insert a single row with INSERT INTO ... VALUES
Add one record, specifying values for each column or omitting columns with defaults.
Insert multiple rows at once
Provide several value sets separated by commas, e.g., INSERT INTO table (col1,col2) VALUES (1,'A'), (2,'B');
Insert data from another table (INSERT INTO ... SELECT)
Copy rows from one table to another, optionally transforming data.
Update existing rows with UPDATE ... SET
Modify column values, always include a WHERE clause to limit rows unless intending to update all.
Delete rows safely with DELETE FROM ... WHERE
Remove specific rows; consider using a transaction and checking rows affected before committing.