Relational-Database / README.md
README.md
Raw

Relational-Database

A program in C++ intended to emulate a basic relational database. The input arguments are loosely based on SQL.

Using the database:

  1. Download and extract the TableEntry file as well as the two relData files to a folder
  2. Using the command line, navigate to the folder
  3. Create and run an executible for the relData.cpp file

Commands:

  • CREATE a table using the CREATE command followed a space and the desired name of the table. Then, specify the number of columns, and for each column, specify the datatype of the column and then the name. -> Syntax: "CREATE <# of columns> "

  • INSERT INTO a table using the CREATE INTO command followed a space and the name of the table in which insertion will take place. Then, specify the number of rows that will be added, and for each row, add the data. -> Syntax: "INSERT INTO <# of rows> ROWS" " " " "

  • DELETE FROM a table using the DELETE FROM command followed by a space and the name of the table in which deletion will take place. Then, type "WHERE" and define an operation (=, >, or <) followed by a value that matches the datatype of the column. -> Syntax: "DELETE FROM WHERE "

  • GENERATE INDEX on a table using the GENERATE FOR command followed by a space and the name of the table for which an index will be generated. Then, specify either 'hash' or 'bst' and type "INDEX ON" followed by the column name. -> Syntax: "GENERATE FOR <hash/bst> INDEX ON "

  • PRINT FROM a table using the PRINT FROM command followed by a space and the name of the table from which data will be printed. Then, specify the number of columns to be printed followed by the names of those columns. Lastly, specify whether ALL the data is to be printed or certain data found through an operation. -> Syntax: "PRINT FROM <# of rows> [WHERE | ALL]"

  • JOIN two tables using the JOIN command followed by a space and the name of the first table, then 'AND', and the name of the second table. Then, type "WHERE" and give the name of one column from the first table, followed by " = " and the name of another column from the second table. This will result in a table where these parameters are true. Lastly, type "AND PRINT" followed by the number of columns to be printed, and then each column followed by whichever table it is associated with. -> Syntax: "JOIN AND WHERE = AND PRINT <# of cols> <1|2> <1|2>"

  • REMOVE a table using the REMOVE command followed by a space and the name of the table to be removed (freed from memory). -> Syntax: "REMOVE "

  • QUIT the program by using the QUIT command. -> Syntax: "QUIT"

Valid Datatypes: Int, string, bool, double

TODO:

  • Add File I/O integration
  • Time speedups