/Vet-Clinic-Database

In this project, I use a relational database to create the data structure for a vet clinic.

Primary LanguagePLpgSQLMIT LicenseMIT

Vet Clinic Database 🏥

Description:

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.

Built With

  • Relational Database PostgreSQL
  • Visual Studio Code

Schema Diagram

Diagram

Getting Started

Follow these steps in the "SQL Shell (psql)":

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.

This repository includes files with plain SQL that can be used to recreate a database:

  • 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!

Author

Marco Marco Oquendo

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

Acknowledgments

📝 License

This project is MIT licensed.