Tutorial
A hands-on tutorial in the style of the MySQL tutorial, using only statements that were checked against MySQL and MariaDB, from creating a database to prepared statements.
- Connecting and creating a database: Connect with the mysql client, see what the server says about itself, and create, use and drop a database.
- Tables, keys and types: Create tables with primary keys, unique keys, defaults and several column types, and look at them with DESCRIBE and SHOW CREATE TABLE.
- Inserting, selecting, updating and deleting: Insert rows, read them with WHERE, ORDER BY and LIMIT, update and delete, and see how Raft DB refuses bad values with MySQL's error numbers.
- Joins, grouping and subqueries: Join tables, group and aggregate, filter groups with HAVING, and use subqueries, UNION and the set operators, with a set of sample tables.
- Window functions and common table expressions: Rank and total rows with window functions, name subqueries with WITH, and walk a hierarchy with a recursive CTE, using checked examples.
- JSON documents and functions: Store JSON in a column, extract and filter with -> and ->>, and use the JSON functions that are compared with real MySQL and MariaDB.
- Indexes, constraints and generated columns: Create and drop indexes, use unique, foreign-key and CHECK constraints, generated columns and functional indexes, with checked statements.
- Transactions: Group statements with START TRANSACTION, COMMIT, ROLLBACK and savepoints, and learn exactly which guarantees Raft DB gives and which it does not.
- Views, stored procedures and triggers: Save a query as a view, write a stored procedure and function with loops and handlers, and react to changes with triggers, using checked examples.
- Prepared statements, sequences and RETURNING: Use prepared statements, the MariaDB-dialect sequences, OR REPLACE and RETURNING, and see how a driver's binary prepared statements differ from SQL-level PREPARE.