Skip to content

AhmedHawater2003/Database-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database-Engine

Database Engine that supports some features like:

  • Creating a table
  • Inserting into a table
  • Updating a table
  • Deleting from a table
  • Selecting from a table
  • Creating an Index -using B+ Tree-
  • Writing SQL queries
  • Supported data types: int (java.lang.Integer), double (java.lang.Double) and varchar (java.lang.String)

Apache Maven badge Junit 5 badge Git badge Github badge Java badge ANTLR badge

Tools

  • Language used is Java
  • Project is built using maven
  • Tests are written in Junit5
  • GUI is built with JavaFx
  • SQL is parsed using ANTLR

Code examples

Normal Selection

SQLTerm[] sqlTerms = new SQLTerm[2];
sqlTerms[0] = new SQLTerm("Students", "gpa", "=", 4.0);
sqlTerms[1] = new SQLTerm("Students", "id", ">", 100);
String[] strArrOperator = new String[] { "AND" };
engine.selectFromTable(sqlTerms, strArrOperator);

Selection Using SQL

StringBuffer command = new StringBuffer("SELECT * FROM Students WHERE gpa = 4.0 AND id > 100");
engine.parseSQL(command);

Normal Insertion

Hashtable<String, Object> htblColNameValue = new Hashtable<>();
htblColNameValue.put("id", 1);
htblColNameValue.put("name", "student1");
htblColNameValue.put("gpa", 3.3);
engine.insertIntoTable("Students", htblColNameValue);

Insertion Using SQL

StringBuffer command = new StringBuffer("INSERT INTO Students(id, gpa, name) VALUES(1, 3.3, 'student1')");
		engine.parseSQL(command);

Normal Deletion

Hashtable<String, Object> htblColNameValue = new Hashtable<>();
htblColNameValue.put("gpa", 3.3);
engine.DeleteFromTable("Students", htblColNameValue);

Deletion Using SQL

StringBuffer command = new StringBuffer("DELETE FROM  Students WHERE gpa = 3.3");
		engine.parseSQL(command);

Run Locally

1- Clone the project

  git clone https://github.com/AhmedHawater2003/Database-Engine.git

2- Go to the project directory

3- Build the project using Maven

  mvn clean

4- Run Javafx project using Maven

  mvn javafx:run

License

MIT License

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages