From 823533c7d0da5ff0076d8b34b6ba40d59a943230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Moravec?= Date: Sun, 28 Jan 2024 23:29:17 +0100 Subject: [PATCH] docs: add example query --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 250fb95..00c3e56 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ To exit the REPL client, enter `exit` or `quit`. CREATE TABLE ( , ...); ``` +With the demo database, this can be used to create a new table: +```sql +CREATE TABLE games (id UUID PRIMARY KEY, name STRING, year INT, price NUMBER); +``` + ### `CREATE INDEX` - Indexing is not supported for the `NUMBER` data type @@ -77,6 +82,11 @@ CREATE TABLE ( , ...); CREATE INDEX ON (); ``` +With the demo database, this can be used to create a new index: +```sql +CREATE INDEX CarsYear ON cars (year); +``` + ### `SELECT` - `WHERE` clause is optional and only equality is supported - All columns can be selected with `*` @@ -85,12 +95,23 @@ CREATE INDEX ON (); SELECT , ... FROM [WHERE = ]; ``` +With the demo database, this can be used to select all cars with year 2001: +```sql +SELECT * FROM cars WHERE year = 2001; +``` + ### `INSERT` ```sql INSERT INTO (, ...) VALUES (, ...); ``` +With the demo database, this can be used to insert a new user: +```sql +INSERT INTO users (id, name, surname, email) VALUES (u12345, "John", "Doe", "johhny.trucker@seznam.cz"); +``` + + ### `DELETE` - `WHERE` clause is optional and only equality is supported @@ -98,6 +119,11 @@ INSERT INTO (, ...) VALUES (, ...); DELETE FROM [WHERE = ]; ``` +With the demo database, this can be used to delete all users with name Christina: +```sql +DELETE FROM users WHERE name = "Christina"; +``` + ## Data Types - `UUID` - special integer prefixed with `u`, e.g. `u12345` - `STRING` - string enclosed in double quotes, e.g. `"Hello World"`