Skip to content

About

An interpreter for a subset of SQL

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

Mini SQL-Interpreter

An interpreter for a subset of SQL
C++ IntelliJ

Description

The interpreter supports the following SQL commands:

  • SELECT
  • CREATE TABLE
  • DROP TABLE
  • INSERT
  • UPDATE
  • DELETE
  • HELP

Commands like: Select, Insert & Delete have support for an optional 'WHERE' command with specific type of conditional queries ( condition1 AND condition2 AND ...) or (condition1 OR condition2 OR ...).

Queries are *NOT* case sensitive except with indentifiers and aren't affected by redundant white spaces.

FOREIGN & PRIMARY KEYS are also supported.
Example query := CREATE TABLE table_name (id INT PRIMARY KEY, name STR, dept INT FOREIGN KEY REFERENCES table_name table_column).

Working of the Interpreter

The query goes through the following stages to display the final result:

  • Token Generation: Every query is first passed to a Scanner class that breaks down the query into tokens and returns an array of tokens.
  • Parser: The array of tokens is passed to a Parser class that ensures syntactical correctness of the query and returns an object containing all the information the interpreter will need in its final stage.
  • Interpreter: Depending on the type of query, the interpreter creates, modifies, deletes or displays the requested table(s).

About

An interpreter for a subset of SQL

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages