Programming Academy
Learn SQL with real tables: students and marks, a canteen, a library, the IPL, then a shop and a company. Pick rows, sort them, add them up and join tables, then change data and design your own tables. Every query runs right on the page.
45 lessons, about 305 minutes so far · the first 3 lessons free
45 lessons
What a database is, and your first queries: show a whole table, pick the columns you want, do sums, and read what SQLite tells you when something's wrong.
WHERE picks the rows you want: comparisons, AND, OR and NOT, lists with IN, ranges with BETWEEN, patterns with LIKE, and missing values (NULL).
Put rows in order with ORDER BY, take the top few with LIMIT, skip with OFFSET, and drop repeats with DISTINCT.
COUNT, SUM, AVG, MIN and MAX sum up a whole table, GROUP BY sums up each group, and HAVING picks groups.
Real data is split across tables. JOIN puts them back together: INNER JOIN, LEFT JOIN, several tables at once, and a table joined to itself.
Add rows with INSERT, change them with UPDATE, remove them with DELETE, and keep changes safe with transactions.
Design your own tables with CREATE TABLE: types, primary keys, NOT NULL, UNIQUE, DEFAULT, CHECK and foreign keys, then change them with ALTER TABLE.
A query inside a query, IN and EXISTS, CASE for if-this-then-that, and views that save a query as a table.
Put it all together: real questions about a shop, a company and a school, each answered with your own SQL.