https://github.com/aswajith7077/dbshell
A SQL-based command line system using C and bash script. Integrated concurrency control using file locking mechanisms. Command line parsing is done using the readline library in C.
https://github.com/aswajith7077/dbshell
c shell-script sql
Last synced: over 1 year ago
JSON representation
A SQL-based command line system using C and bash script. Integrated concurrency control using file locking mechanisms. Command line parsing is done using the readline library in C.
- Host: GitHub
- URL: https://github.com/aswajith7077/dbshell
- Owner: Aswajith7077
- Created: 2025-01-17T06:05:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-17T06:32:28.000Z (over 1 year ago)
- Last Synced: 2025-01-29T09:40:55.070Z (over 1 year ago)
- Topics: c, shell-script, sql
- Language: C
- Homepage:
- Size: 56.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Basic Implementation of Database in shell script**
The script immediately runs authentication function that will keep track of users and
stores them into a log file.
A database file consist of contents of database
- Administrators can alone create the database file.
- Other Users cannot create or delete the database file.
- Other Users can create a SQL file and perform queries that modifies the
contents of the database file.
Then a database shell is created and the shell can perform the following operations:
1. If the user is a database administrator, he can perform a CREATE USER to create
a user.
2. **EXIT**: can terminate the shell
3. **LOGOUT**: can logout from the database user.
4. **PERFORM** *filename*: Opens up a new window to write SQL Queries.
5. **COMPILE** *filename*: Runs the file with SQL Queries.
6. Any invalid operation will create a log entry with an alert message.
The Default administrator is given by,
1. **USERNAME**: SYS
2. **PASSWORD**: *Created by the first user*
For a User Can perform the following operations in a SQL file:
1. INSERT INTO *table_name* VALUES(*value_1*, *value_2*, *value_3*,...);
- Inserts the list of values to the given table name
2. UPDATE INTO *table_name*:
- Updates a value to the attribute--
- Can specify a WHERE condition to sort out the records.
3. SELECT:
- Should specify the attributes----
- ***ORDERBY*** sorts the file according to the order specified based on the specified field.
- ***WHERE CONDITION*** selects the specifies records from the database
- ***GROUPBY*** groups the records based on a particular field
- ***HAVING*** conditions for a ***GROUP BY***
4. DELETE:
- Deletes all the records by default.
- WHERE sorts out the records based on the field
# **How to Run**
1. Compile the C program,
```
gcc user.c
```
2. Then finally run the bash script
```
bash ./sample.sh
```