Table of Contents
- TL;DR: What You Will Learn
- How To Read and Use This Cheat Sheet
- The Conventions I Use Here
- Tables, Rows and Columns in Plain English
- A Singapore Scenario You Can Picture
- Where To Actually Run These
- Data Query Commands for Retrieving Records
- SELECT and SELECT DISTINCT
- LIMIT and Aliasing with AS
- Selecting All Columns with the Asterisk
- Filtering And Sorting Your Results
- WHERE with Comparison Operators
- Combining Conditions With AND, OR, IN, BETWEEN And LIKE
- Handling NULL the Right Way
- Sorting with ORDER BY
- Joining Tables To Combine Data
- INNER JOIN
- LEFT and RIGHT JOIN
- FULL OUTER JOIN and the ON Condition
- Aggregate Functions And Grouping
- COUNT, SUM, AVG, MIN and MAX
- GROUP BY for Per-Category Totals
- HAVING Versus WHERE
- Feeding Your Dashboards
- Data Modification Commands
- INSERT INTO for Adding Rows
- UPDATE with a WHERE Clause
- DELETE and the Danger of Omitting WHERE
- TRUNCATE versus DELETE, and Using Transactions
- Table And Database Structure Basics
- CREATE TABLE And Common Data Types
- ALTER TABLE to Add or Change Columns
- DROP TABLE and When Not to Use It
- Putting the Commands Together in a Real Query
- Building the Query Step by Step
- Why Clause Order Trips Beginners Up
- How To Start Learning SQL for Beginners, Step by Step
- Use It Alongside Real Practice
- Conclusion
Share This





Reader Interactions