car_company_database
car_company_database copied to clipboard
A sample relational database using sqlite database
Car Company Database
For best viewing experiance please view at https://github.com/dtaivpp/car_company_database
Also, please note these instructions are written from the perspective of the macOS however can still work with small modifications on windows or linux.
About the Database
This database is designed to handle the everyday operations of a major car company. It provides functionality to view the transactions of dealers, track car inventory, and maintain the models and avaliable options of cars. See the below file to view the Entity Relationship diagram for the database.
The databases uses triggers, primary, and foreign keys to ensure the constraints of the database are maintianted upon insertion. Each entitiy has an autogenerated ID to ensure they are unique and to ensure that the transformations are easier.

Setting up the database
*Note this is using the already built database
- First go ahead and download sqlite from here: https://www.sqlite.org/index.html using version 3.24.0
- After installing open a commandline or terminal and clone the repositiory using
git clone https://github.com/dtaivpp/car_company_database.git - From the terminal then navigate to the directory that you just cloned called car_company_database
- Next run
sqlite3 Car_Database.dbto open the database in the terminal
Building the database from scratch
- Use steps 1 - 3 from the previous section
- Alternatively you can build the database from the source files by running
sqlite3 .open {Name for your database here}.dbto create a new database - Next you would run from your sqlite shell
.read Create_Tables.sqlto create the tables - Run
.read Triggers.sqlfrom your sqlite shell to create the triggers to ensure inserts do not break any rules of the database such as adding a model with an invalid option set id. - Finally you would run
.read Insert.sqlfrom your sqlite shell to populate the tables with the data
Running Sample SQL operations
- If your database is alredy open skip to step 3. Otherwise open up a terminal and navigate to the directory your database is in.
- Next run
sqlite3 Car_Database.dbto open the database in the terminal - Next you would run from your sqlite shell
.read {Query Name Here}.sqlwithout the curls to run the query from the file