A database server that allows users to use a simplified version of the SQL database query language. The parser, interpreter, and aforementioned functionality are built from scratch using Java, Maven, and JUnit with proper testing, while the file system is being used to be able to persistently store data.
The query language we shall use for this purpose supports the following main types of query:
Command | Functionality |
---|---|
USE | Changes the database against which the following queries will be run |
CREATE | Constructs a new database or table (depending on the provided parameters) |
INSERT | Adds a new record (row) to an existing table |
SELECT | Searches for records that match the given condition |
UPDATE | Changes the existing data contained within a table |
ALTER | Changes the structure (columns) of an existing table: add or drop |
DELETE | Removes records that match the given condition from an existing table |
DROP | Removes a specified table from a database, or removes the entire database |
JOIN | Performs an inner join on two tables (returning all permutations of all matching records) |
A grammar that fully defines the simplified query language is provided in this BNF document.
- Primary key is always called
id
and is auto-generated by the server. - Table and database names are case-sensitive for querying, but will be saved as lowercase.
- SQL keywords are reserved words and are case-insensitive.
- Column names are case-insensitive for querying, but the case given by the users will be preserved.
- Foreign keys can not be set using query language, but relies on the user to remember which attributes are keys to maintain table relationships.
- For comparison, no data will be returned if it is not valid.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Java Development Kit (JDK) 19
- Apache Maven 3.9.0
Follow these steps to get the development environment running:
- Clone this repository using
git clone https://github.com/smallpaes/database-server.git
. - Navigate to the project directory using
cd database-server
. - Run
./mvnw clean install
to build the project and install the necessary dependencies.
# Run the server
$ ./mvnw exec:java@server
# Run the client to start querying
$ ./mvnw exec:java@client
Run ./mvnw compile
to compile the project.
Run ./mvnw test
for testing.
- This is an assignment given by the instructor at the University of Bristol: Simon from the course of Object-Oriented Programming with Java 2022.
- This assignment is built on top on the base Maven project.