MODULES
12
EASY
4
MEDIUM
5
HARD
3
STRUCTURES_
SELECT
easy
SQL Basics
❯ SELECT, WHERE, ORDER BY, and basic queries
VARCHAR
easy
Data Types & Constraints
❯ Understanding SQL data types and constraints
JOIN
medium
Joins
❯ INNER, LEFT, RIGHT, FULL OUTER, and CROSS joins
SUM()
easy
Aggregate Functions
❯ COUNT, SUM, AVG, MIN, MAX, and GROUP BY
()
medium
Subqueries
❯ Nested queries and correlated subqueries
INDEX
hard
Indexes & Performance
❯ Creating indexes and query optimization
ACID
medium
Transactions
❯ Transaction management and data integrity
VIEW
medium
Views & Procs
❯ Creating views and stored procedures
schema
hard
Database Design
❯ Normalization, ER diagrams, and schema design
CTE
hard
Advanced Queries
❯ Window functions, CTEs, and complex queries
DML
easy
Data Manipulation
❯ INSERT, UPDATE, DELETE, and MERGE operations
GRANT
medium
Security
❯ User management, roles, and access control
COMMANDS
SELECT
Extracts data from a database
UPDATE
Updates data in a database
DELETE
Deletes data from a database
INSERT INTO
Inserts new data into a database
CREATE DATABASE
Creates a new database
ALTER TABLE
Modifies an existing table
SYNTAX_DEMO
queries.sql
-- ============================================
-- COMPLEX QUERY & JOINS
-- ============================================
-- Find top users by revenue using Common Table Expressions (CTE)
WITH MonthlyRevenue AS (
SELECT
user_id,
DATE_TRUNC('month', created_at) AS month,
SUM(amount) AS total_spent
FROM orders
WHERE status = 'COMPLETED'
GROUP BY 1, 2
)
SELECT
u.username,
u.email,
mr.total_spent
FROM users u
INNER JOIN MonthlyRevenue mr
ON u.id = mr.user_id
WHERE mr.total_spent > 1000
ORDER BY mr.total_spent DESC
LIMIT 10;