SQL exercises online
SQL is the query language for databases - the same ones behind an online shop, an electronic class register and a phone app. The fastest way to learn it is by practice: you write a query, run it and immediately see the result in a table. On BitWizards you do this in the browser, without installing a database server.
There are three routes (all courses are in Polish):
- Without signing in - the course SQLite: basics and differences from MySQL. The database runs entirely in your browser and the exercises check themselves.
- For the INF.03 exam - the course INF.03: SQL queries with exam-style queries and two mock papers; more on the INF.03 exam page.
- PHP with a MySQL database - the course PHP and MySQL: pages with a database: a MariaDB database (compatible with MySQL) in the browser tab, together with PHP and phpMyAdmin, also without signing in.
Practise SQL without signing in
What you will learn
SELECT,WHERE, sorting (ORDER BY),LIKE,IN,BETWEENand functions.- Aggregate functions and grouping:
COUNT,SUM,AVG,GROUP BY,HAVING. - Joining tables:
JOINandLEFT JOIN. - Modifying data:
INSERT,UPDATE,DELETE. - Creating tables, data types, primary and foreign keys,
UNIQUEandCHECKconstraints.
Basic SQL looks almost identical in SQLite and MySQL. A SELECT with WHERE, JOIN or GROUP BY is written the same way in both, so what you learn in the browser carries straight over to the exam and to work.
SQL exercises with auto-checking
Every exercise has a table with starting data and a task, e.g. “list the titles of games rated above 4, newest first”. When you run your query, the platform compares its result with the result of the model solution. What counts is the content of the result table, not identical query text - the same result can be reached with different queries and every correct one passes. If the task requires sorting, the order of rows matters too.
The course has examples (a ready query you run and modify) and exercises to solve on your own. Completed exercises are marked with a star, so you always know where you left off.
Differences between SQLite and MySQL
This part of the course is useful for anyone who knows or will learn MySQL. You see the differences on working examples, not just in a table:
- Data types - SQLite has flexible types and accepts text in an
INTEGERcolumn, MySQL is strict. See the topic Tables and types: the biggest difference (in Polish). - Auto-numbering -
INTEGER PRIMARY KEYin SQLite instead ofAUTO_INCREMENTin MySQL. - Dates - SQLite has no native
DATEtype; dates are stored as text and handled withdate()andstrftime(). - Foreign keys - off by default in SQLite, on from the start in MySQL (InnoDB).
- UPSERT -
ON CONFLICTin SQLite instead ofON DUPLICATE KEY UPDATEin MySQL.
The last topic of the course sums it all up: SQLite in practice + a cheat sheet of differences (in Polish). More about SQLite itself is on the SQLite course page.
MySQL in a browser tab: the student’s own database
PHP exercises with a database run on MariaDB (a MySQL-compatible server) that starts in the student’s browser tab. This is my own environment: I connected a WebAssembly database engine to PHP through my own MySQL protocol server, and added phpMyAdmin in the tab and a history of database changes. As a result:
- every exercise has a separate database, so students cannot see or break each other’s data,
- the “Restore starting data” button rebuilds the exercise database in one click, so
UPDATEandDELETEcan be tried freely, - queries are typed in the SQL panel or in a real phpMyAdmin, with nothing to install,
- every command that changes data goes into the work history, which the teacher can replay.
PHP works on the same database: the student’s script connects through mysqli and generates a page with data, like the application in the exam. Running SQL and PHP on the BitWizards server still exists, but stays in reserve. Without signing in you can practise this in the PHP and MySQL: pages with a database course: queries from PHP, lists and tables, INSERT, UPDATE and DELETE, forms and an INF.03-style project. The basics of PHP itself are in the course PHP: basics in the browser (in Polish).
The teacher sees the student’s work live, can replay the history of writing queries and give a grade on the 1-6 scale. How to set up a class is described on the for schools and getting started pages.
SQL and the INF.03 exam
Databases are part of the name of the INF.03 qualification (Polish vocational IT exam): creating and administering websites, web applications and databases. In the practical part you prepare a database, write SQL queries and use them in a web application, usually together with PHP. The exam uses MySQL or MariaDB, but queries such as SELECT, JOIN, INSERT or UPDATE practised in the SQLite course are written the same way there. Knowing the differences helps avoid traps with types and keys.
SQL in the computer science matura
The Polish computer science matura (school-leaving exam) includes database tasks: several related tables in text files and questions about summaries, counts or records meeting conditions. Such tasks can be solved with SQL queries. The SQLite course teaches exactly these skills: filtering, grouping, aggregation and joining tables. Databases and SQL at the extended level are covered by the class course Informatyka - liceum klasa 3, zakres rozszerzony (general secondary school, grade 3, extended level; topics 27-40), and matura database tasks are revised in grade 4. At the basic level, queries are in the courses general secondary grade 2 and technical school grade 1 (all in Polish). A wider overview of programming at school is on the computer science at school page.
Related technologies
SQLite - PHP - HTML and CSS - JavaScript