In this project, I use a relational database to create the data structure for a vet clinic. Here you can find the code to:
- Section 1:
- Create a table to store animals' information,
- Insert some data into it, and query it.
- Section 2:
- Use transactions to update and delete records.
- Use aggregate functions and GROUP BY to answer analytical questions.
- Section 3:
- Add some new tables.
- Add foreign key columns to the existing animals' table to model one-to-many relationships.
- Use JOIN to query the data.
- Section 4:
- Add some many-to-many relationships.
- Write more complex queries to use them to answer questions.
- Relational Database PostgreSQL
- Visual Studio Code
First create a database:
CREATE DATABASE vet_clinic;
The console should answer with "CREATE DATABASE" message.
Open the database created to start working on it:
\c vet_clinic
The console should answer with "Now you are connected to the <<vet_clinic>> database with the user <>" And it should change the beginning of the lines to "vet_clinic=#" line.
- Use schema.sql to create all tables.
- Use data.sql to populate tables with sample data.
- Check queries.sql for examples of queries that can be run on a newly created database. Important note: this file might include queries that make changes in the database (e.g., remove records). Use them responsibly!
- GitHub: @MarcoOquendoC.
- Twitter: @marcooquendoc.
- LinkedIn: Marco Vinicio Oquendo.
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
- Hat tip to friends who helped me with the concepts.
- John Nduati Kagiri.
- Michael Mesfin.
This project is MIT licensed.