1. Tables & keys Describe your base + joined tables
These questions drive the choice between LEFT JOIN, INNER JOIN, WHERE EXISTS, and aggregates.
2. Generated SQL & explanation Copy, paste, tweak, teach your friend
3. Expert Q&A Common SQL join questions answered
• LEFT JOIN keeps all rows from table 1 (left table)
• Columns from tables 2, 3, 4 are added where matches exist
• No matches? Those columns are NULL - table 1 row is still kept
• MAX(t2.column) is only needed if table 2 has MULTIPLE rows per table 1 row and you want to aggregate
• WHERE EXISTS is for filtering - it would remove table 1 rows that don't have matches, which is NOT what you want
Use this pattern:
SELECT t1.*, t2.*, t3.*, t4.* FROM Table1 t1 LEFT JOIN Table2 t2 ON t1.id = t2.id LEFT JOIN Table3 t3 ON t1.id = t3.id LEFT JOIN Table4 t4 ON t1.id = t4.id
• You want to know "does a related row exist?" but don't need data from it
• Performance benefit: stops searching after finding first match
• Cleaner for existence checks in correlated subqueries
• Better when checking multiple conditions on related tables
Example: "Show me customers who have placed orders"
SELECT * FROM Customers c WHERE EXISTS (SELECT 1 FROM Orders o WHERE o.customer_id = c.id)vs JOIN: "Show me customers with their order details"
SELECT c.*, o.* FROM Customers c INNER JOIN Orders o ON c.id = o.customer_id
• Without aggregates: You get duplicate base rows (1 per joined row)
• With aggregates + GROUP BY: You get 1 base row with summarized data
Example scenario: Each customer has multiple orders, you want the most recent order date:
SELECT c.*, MAX(o.order_date) as latest_order FROM Customers c LEFT JOIN Orders o ON c.id = o.customer_id GROUP BY c.idCommon aggregates:
• MAX(date_column) - latest/highest value
• MIN(date_column) - earliest/lowest value
• COUNT(*) - how many related rows
• SUM(amount) - total of a numeric column
LEFT JOIN (LEFT OUTER JOIN):
• Keeps ALL rows from the left (base) table
• Adds columns from right table where matches exist
• Right table columns are NULL when no match
• Use when: "Keep my base data, enhance with optional related data"
INNER JOIN:
• Keeps ONLY rows that have matches in BOTH tables
• Filters out base rows without matches
• Use when: "Show only records that have related data in both tables"
Visual example:
Base table: 100 customers
Related table: 70 have orders
• LEFT JOIN result: 100 rows (all customers, 30 with NULL order data)
• INNER JOIN result: 70 rows (only customers with orders)
Problem: Customer has 3 orders AND 2 addresses → CROSS JOIN effect = 6 rows per customer!
Solution 1: Aggregate separately then join:
SELECT c.*, o.order_count, a.address_count
FROM Customers c
LEFT JOIN (SELECT customer_id, COUNT(*) as order_count FROM Orders GROUP BY customer_id) o ON c.id = o.customer_id
LEFT JOIN (SELECT customer_id, COUNT(*) as address_count FROM Addresses GROUP BY customer_id) a ON c.id = a.customer_idSolution 2: Use DISTINCT with careful column selection
Solution 3: Run separate queries and merge in application code
Best practice: Aggregate before joining when dealing with multiple 1-to-many relationships
Essential indexes:
• Index ALL columns used in JOIN conditions (ON clauses)
• Index foreign key columns in child tables
• Composite indexes for multi-column joins
Performance tips:
1. Index join keys: CREATE INDEX idx_orders_customer ON Orders(customer_id)
2. Filter early: Put WHERE clauses on the largest tables
3. Use EXISTS for checks: Faster than COUNT(*) > 0
4. EXPLAIN your queries: Always check query execution plans
5. Avoid SELECT *: Only fetch columns you need
For government/classified data:
• Use query timeouts to prevent resource exhaustion
• Implement row-level security with WHERE clauses
• Consider partitioning large tables by date/classification
• Use covering indexes to avoid table lookups
🌐 API Request Builder & Tester
Test API endpoints without leaving your browser. Perfect for quick API debugging and exploration.
🔍 Regular Expression Tester
Test and debug regular expressions with live matching and group extraction.
\d+ (numbers), [A-Za-z]+ (letters), \b\w+@\w+\.\w+\b (email)📋 JSON/XML Formatter & Validator
Format, validate, and beautify JSON and XML data. Also minify for production use.
🔐 Encode/Decode Utilities
Quickly encode or decode text in various formats: Base64, URL, HTML entities, JWT inspection.
⚡ Time, Color & Unit Converters
Convert between timestamps, colors, and common units.