Developer Reference

SQL Cheatsheet & Syntax Reference

Quickly look up SQL syntax, clauses, and functions. Test any command immediately using our online SQL compiler.

1. Querying Data (SELECT & Filters)

SELECT col1, col2 FROM table_name;
SELECT DISTINCT category FROM products;
SELECT * FROM customers WHERE city = 'San Francisco';

2. Joining Tables

SELECT * FROM orders JOIN customers ON orders.customer_id = customers.id;
SELECT * FROM customers LEFT JOIN orders ON customers.id = orders.customer_id;

3. Aggregations & Grouping

SELECT category, COUNT(*), AVG(unit_price) FROM products GROUP BY category;
SELECT customer_id, SUM(total_amount) FROM orders GROUP BY customer_id HAVING SUM(total_amount) > 500;
Interactive SQL Editor3 tables available
Press "Run Query" or Ctrl+Enter
Executing query...