updated docu
This commit is contained in:
parent
c1db8a3f4e
commit
1674f64910
|
@ -18,6 +18,7 @@ To use the SQL Parser in your own code, you only need to include `SQLParser.h` a
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
|
* [Working Syntax Examples](docs/sytax.md)
|
||||||
* [Developer Documentation](docs/documentation.md)
|
* [Developer Documentation](docs/documentation.md)
|
||||||
* [Integration in Hyrise](docs/integration.md)
|
* [Integration in Hyrise](docs/integration.md)
|
||||||
* [Known Issues](docs/issues.md)
|
* [Known Issues](docs/issues.md)
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
Syntax Examples
|
||||||
|
===============
|
||||||
|
|
||||||
|
This page contains some samples of SQL statements that can be executed in Hyrise.
|
||||||
|
|
||||||
|
|
||||||
|
**Create Tables**
|
||||||
|
```sql
|
||||||
|
CREATE TABLE IF NOT EXISTS students FROM TBL FILE 'test/students.tbl';
|
||||||
|
CREATE TABLE test (v1 INTEGER, v2 INTEGER, v3 INTEGER);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**Select with Join**
|
||||||
|
```sql
|
||||||
|
SELECT name, city, * FROM students AS t1 JOIN students AS t2 ON t1.city = t2.city WHERE t1.grade < 2.0 AND t2.grade > 2.0 AND t1.city = 'Frohnau' ORDER BY t1.grade DESC;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**Group By**
|
||||||
|
```sql
|
||||||
|
SELECT city, AVG(grade) AS average, MIN(grade) AS best, MAX(grade) AS worst FROM students GROUP BY city;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**Update and Delete**
|
||||||
|
```sql
|
||||||
|
UPDATE students SET name='Max Mustermann' WHERE name = 'Ralf Stiebitz';
|
||||||
|
DELETE FROM students WHERE name = 'Max Mustermann';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
**Prepare and Execute**
|
||||||
|
```sql
|
||||||
|
PREPARE batch_insert {
|
||||||
|
INSERT INTO test VALUES (?, 0, 0);
|
||||||
|
INSERT INTO test VALUES (?, 0, 0);
|
||||||
|
INSERT INTO test VALUES (?, 0, 0);
|
||||||
|
INSERT INTO test VALUES (?, 0, 0);
|
||||||
|
INSERT INTO test VALUES (?, 0, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
EXECUTE insert_test(1, 2, 3, 4 ,5);
|
||||||
|
```
|
Loading…
Reference in New Issue