Welcome to Bash-SQL, a simple Database Management System implemented in Bash.
This project provides a basic DBMS functionality, supporting various commands varying from DCL and DDL to DML. It's designed to be a lightweight solution for simple database operations within a Bash environment.
This is a subset of SQL responsible for defining and managing access and permissions to SYSTEM objects like (users, schemas, databases, tables, ... ).
To Create a new user
- Format:
REGISTER USER username password - Example:
REGISTER USER Ghaly 12345 - Complexity: O(U)
- U: is the number of users in the system
To delete your account from the system
You have to be logged in and not connected to a database
- Format:
DELETE USER - Complexity: O(U)
To log into the system
- Format:
LOGIN USER username password - Example:
LOGIN USER Ghaly 12345 - Complexity: O(U)
To log out from the system
- Format:
LOGOUT - Complexity: O(1)
- Format:
CREATE DATABASE database - Example:
CREATE DATABASE COLLEGE - Complexity: O(1)
- Format:
DROP DATABASE database - Example:
DROP DATABASE COLLEGE - Complexity: O(1)
- Format:
CONNECT DATABASE database - Example:
CONNECT DATABASE COLLEGE - Complexity: O(1)
To disconnect from a database
- Format:
DISCONNECT - Complexity: O(1)
To list all the databases in the system
- Format:
LIST DATABASES - Complexity: O(1)
This is a subset of SQL used for defining and managing the structure of a database, including creating, modifying, and deleting database objects like tables.
You need to be connected to a database to run these commands
- Format:
CREATE TABLE table (column/data type/constraint, ... ) - Example:
CREATE TABLE STUDENTS (ID/INT/PK, NAME/STRING/REQUIRED, CITY/STRING, AGE/INT, EMAIL/STRING/UNIQUE) - Complexity: O(C)
- C: is the number of columns in the table
- Constraints
- Primary Key (PK)
- Foreign Key (FK) Still Yet to be Integrated
- Unique
- Required
- Format:
DROP TABLE table - Example:
DROP TABLE STUDENTS - Complexity: O(1)
- Format:
TRUNCATE TABLE table - Example:
TRUNCATE TABLE STUDENTS - Complexity: O(1)
- Still Yet To be Implemented
- Format:
DROP COLUMN table, column - Example:
DROP COLUMN STUDENTS, AGE - Complexity: O(N)
- N: is the number of rows in the table
To list all the tables in the database
- Format:
LIST TABLES - Complexity: O(1)
This is a subset of SQL used for interacting with and manipulating data stored in a database.
You need to be connected to a database to run these commands
- Format:
INSET INTO table VALUES [COLUMN1=value, ...] - Example:
INSERT INTO STUDENTS VALUES [ID=1, NAME=Ali, CITY= Cairo, AGE=24] - Complexity: O(N.C)
- Format:
DELETE FROM table WHERE COLUMN1=(value) - Example:
DELETE FROM STUDENTS WHERE NAME=(Aly) - Complexity: O(N)
- Format:
UPDATE table SET [COLUMN1=value, ...] WHERE COLUMN=(value) - Example:
UPDATE STUDENTS SET [AGE=25, NAME=Samy, CITY= ] WHERE NAME = (Bassam)UPDATE STUDENTS SET [CITY=Cairo] - Complexity: O(N.C)
- Format:
SELECT COLUMN1, COLUMN2, ... FROM table WHERE COLUMN=(value) - Example:
SELECT NAME, AGE, ID FROM STUDENTS WHERE NAME = (Aly)SELECT * FROM STUDENTS - Complexity: O(N)
Used to exit the application
- Format:
EXIT - Complexity: O(1)
Used to clear the application's terminal
- Format:
CLEAR - Complexity: O(1)
To use Bash DBMS, follow these steps:
git clone https://github.com/al-ghaly/BSQL-Engine.git
cd BSQL-Engine./BSQL.bash./BSQL.bash >filenameExample
./BSQL.bash script
In the script file write your BSQL Commands each command in a single line and you can use "#" For comments.