This repo contains various SQL queries for learning and reference.
Before you begin make ensure you have the following prerequisites:
- MySQL: Download and install MySQL from here
Follow these steps to set up and use the SQL examples.
- Download and install MySQL using the provided link.
- Clone this repository to your local machine:
git clone https://github.com/ManuelDelarosa1204/sql-examples.git
Log in to the MySQL server using the username and password you set during installation.
Once you're logged in to MySQL, you can use the scripts provided in this repository to create the database, tables, and populate them with data. To ensure proper functionality, it's important to run all the create scripts as the tables have foreign key relationships with each other. You can run the scripts in the MySQL command line with the following syntax:
source /path/to/file
The queries.sql file contains numerous queries and is not recommended to be run as a script but rather a reference to queries that can be preformed on the database.
Explore the SQL examples in this repository to practice and learn SQL queries. Here's a quick start example
-- Select all records from the `employees` table
SELECT * FROM employees;
-- Select all records for a specific employee
SELECT * FROM employees WHERE id = 1;