This is a working mini SQL Engine developed in Python.
The tables are given as ".csv" files with the filename as tablename. If file is named File1.csv, Table name will be File1. Data type are all numbers only!
A "metadata.txt" file also must be provided which has the following structure <begin_table> <table_name> . . <end_table> (See the example in the repo!)
It can handle normal "Select" Queries of following types:
- Select All Records : E.g. "select * from table_name;"
- Aggregate Functions : Simple aggregate functions like count,min,max,avg,sum E.g. "select max(col1) from table1;"
- Project Columns : Could be any number of columns from one or more tables E.g. "select col1,col2 from table_name;"
- Select/Project with distinct from one table : E.g. "select distinct col1,col2 from table1;"
- Select with where from one or more tables : E.g. "select col1,col2 from table1,table2 where col1 = 10 AND col2 = 20;" (Only AND & OR Operators. Multiple Operators supported!)
- Projection of one or more (incl. all) columns from two tables with one join condition : E.g. "select * from table1, table2 where table1.col1=table2.col2;" "select col1,col2 from table1,table2 where table1.col1 = table2.col2;" (Joining columns are printed only once!)
All possible Error Cases are handled!
To run the Parser (using bash script) , type "bash 20172010.sh " [Make sure the tables and the metadata.txt are present!]