-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sudheer
authored
Mar 9, 2018
1 parent
6da5f46
commit f45b47a
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
# SQL-Engine | ||
|
||
- ***Mini-SQL*** engine in ***Python*** which will run a subset of SQL Queries using command line interface. | ||
- ## **Dataset** | ||
- all elements in the fields would be ***integers*** only | ||
- file is named ***File1.csv***, the database table name would be ***File1*** | ||
- ***metadat.txt*** file will be given for schema of corresponding database tables | ||
``` | ||
<begin_table> | ||
<table_name> | ||
<attribute1> | ||
.... | ||
<attributeN> | ||
<end_table> | ||
``` | ||
- ## **Queries** | ||
- **Select** all records: ``` SELECT * FROM table_name; ``` | ||
- **Aggregate** functions: ***sum, average, min, max*** ``` SELECT MAX(col) FROM table_name; ``` | ||
- **Project** coloumns: ``` SELECT col FROM table_name; ``` | ||
- Project with **distinct**: ``` SELECT DISTINCT col FROM table_name; ``` | ||
- Select from **one or more tables**: ``` SELECT col1, col2 FROM table1, table2 WHERE col1=10 AND col2=20; ``` | ||
- Projection from one or more from two tables with **one join condition**: | ||
``` | ||
a. SELECT * FROM table1, table2 WHERE table1.col1=table2.col2; | ||
b. SELECT col1, col2 FROM table1, table2 WHERE table1.col1=table2.col2; | ||
``` | ||
- Basic Error Handling is done | ||
- ## **Execute** | ||
- run SQL-Engine from **python file** ``` python sql_engine.py <query> ``` | ||
- run SQL-Engine from **bash script** ``` bash run.sh ``` |