output.txt
This commit is contained in:
parent
d60f663272
commit
a7463a1e89
1 changed files with 52 additions and 38 deletions
90
OUTPUT.txt
90
OUTPUT.txt
|
@ -1,70 +1,84 @@
|
||||||
Assuming previously defined Attribute, compiled in a vector known as 'vec' and with subsequent numbers added
|
show incorrect/correct example for each cmd/query
|
||||||
|
|
||||||
To create a table:
|
---------------
|
||||||
|
Queries
|
||||||
|
---------------
|
||||||
|
|
||||||
engine.createTable("table1", vec);
|
Selection:
|
||||||
|
|
||||||
|
correct: select ( age == 12 ) people ;
|
||||||
|
incorrect: select ( age ))))) people ;
|
||||||
|
|
||||||
This creates a Relation object with the appropriate Attribute objects. It displays nothing.
|
Projection:
|
||||||
|
|
||||||
To display the table:
|
correct: project ( age ) people ;
|
||||||
|
incorrect: x
|
||||||
|
|
||||||
engine.showTables(engine.getTableFromName("table1"));
|
Renaming:
|
||||||
|
|
||||||
|
correct: rename ( age, years old ) ;
|
||||||
|
incorrect: x
|
||||||
|
|
||||||
This results in such output:
|
Set Union:
|
||||||
|
|
||||||
Display of relation--------------------------------
|
correct: x
|
||||||
Relation name: table1
|
incorrect: x
|
||||||
|
|
||||||
Attribute name: name
|
Set Difference:
|
||||||
Elements: Fry Bender Leela Zoidberg
|
|
||||||
Attribute name: age
|
|
||||||
Elements: 22 5 22 50
|
|
||||||
|
|
||||||
|
correct: x
|
||||||
|
incorrect: x
|
||||||
|
|
||||||
With table3 having an equal domain to table1, this:
|
Cross Product:
|
||||||
|
|
||||||
cout << engine.unionComp(engine.getTableFromName("table1"), engine.getTableFromName("table3"));
|
correct: x
|
||||||
|
incorrect: x
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
Commands
|
||||||
|
-------------------
|
||||||
|
|
||||||
This will display:
|
Open:
|
||||||
|
|
||||||
1
|
correct: OPEN people ;
|
||||||
|
incorrect: OPEN ;
|
||||||
|
|
||||||
|
Close:
|
||||||
|
|
||||||
To project a table's column:
|
correct: CLOSE people ;
|
||||||
|
incorrect: CLOSE ;
|
||||||
|
|
||||||
engine.project((engine.getTableFromName("table1")), "name");
|
Save:
|
||||||
|
|
||||||
|
correct: SAVE people ;
|
||||||
|
incorrect: SAVE ;
|
||||||
|
|
||||||
This will display:
|
Exit:
|
||||||
|
|
||||||
-----------Initiated Query Projection---------
|
correct: EXIT ;
|
||||||
Column Title: name
|
incorrect: EXIT people ;
|
||||||
Fry
|
|
||||||
Bender
|
|
||||||
Leela
|
|
||||||
Zoidberg
|
|
||||||
|
|
||||||
|
Show:
|
||||||
|
|
||||||
With an arbitrary vector of strings as cmds (until we are able to parse effectively):
|
correct: SHOW people ;
|
||||||
|
incorrect: SHOW ;
|
||||||
|
|
||||||
engine.saveToFile(cmds);
|
Create:
|
||||||
|
|
||||||
|
correct: CREATE TABLE people ( age INTEGER, name VARCHAR ( 20 ) ) PRIMARY KEY ( name ) ;
|
||||||
|
incorrect: CREATE TABLE people age name ;
|
||||||
|
|
||||||
This will result in a db file with the contents:
|
Update:
|
||||||
|
|
||||||
CREATE TABLE animals (name VARCHAR(20), kind VARCHAR(8), years INTEGER) PRIMARY KEY (name, kind);
|
correct: x
|
||||||
|
incorrect: x
|
||||||
|
|
||||||
SHOW animals;
|
Insert:
|
||||||
|
|
||||||
|
correct: INSERT INTO people VALUES FROM ( 12, "Benny" ) ;
|
||||||
|
incorrect: INSERT INTO people 12 "Benny" ;
|
||||||
|
|
||||||
|
Delete:
|
||||||
|
|
||||||
//insert
|
correct: x
|
||||||
|
incorrect: x
|
||||||
//delete
|
|
||||||
|
|
||||||
//select
|
|
||||||
|
|
||||||
//product
|
|
||||||
|
|
Reference in a new issue