Write a program supporting operations with simple databases, consisting of multiple tables, each table stored in its own file.
The database should be saved in a main file (directory), which contains a list of the tables in the database.
For each table keep a name and a path to a file in which the table data is saved.
Each column of a database table has a type, and a single table can have columns of multiple different types at the same time. The application must be able to support the following column types:
-
Integer
An integer, which may be preceded by a '+' or '-' sign.
-
Floating-point number
A floating-point number, which may be preceded by a '+' or '-' sign.
-
Character string
A series of random characters enclosed in quotation marks.
-
Blank
Empty cell, specially marked and displayed as "NULL".
The application should support the following commands:
| Command | Description |
|---|---|
| open file | Loads the contents of a file |
| close | Closes the currently open file and clears the currently loaded information |
| save | Writes the database changes back to the same file from which the data was read |
| save as file | Saves the database changes to a different file |
| help | Displays brief information about the commands supported by the program |
| import file | Creates a new table from a file and saves it in the database |
| showtables | Displays a list of the names of all loaded tables |
| describe table | Displays information about the column types of a given table |
| print table | Displays all rows of a given table with page view support |
| export table file | Saves table information in a file |
| select column value table | Prints all rows that contain the value in the column with the given index |
| addcolumn table | Inserts a new column into the table |
| update table search-column search-value target-column target-value | Updates all rows in the table whose search-column contain search-value so that target-column value becomes target-value |
| delete table column value | Deletes all rows in the table whose column contains value |
| insert table values | Inserts a new row in the table with the corresponding values |
| innerjoin table-1 column-1 table-2 column-2 | Performs inner join on two tables using column-1 and column-2 |
| rename old-table new-table | Renames a table |
| count table column value | Counts the rows in the table where column contains value |
| aggregate table search-column value target-column operation | Performs an operation(sum, product, maximum, minimum) on the values in target-column on all rows where search-column contains value |