This repository demonstrates the use of SQL SELECT statements to query databases effectively. The project is based on tasks and concepts learned in a project-based course and was implemented using DataSpell, Docker, DBeaver, and PostgreSQL on a local machine. Below are the details and structure of the repository.
This project aims to provide a hands-on approach to retrieving and manipulating data from tables in a PostgreSQL database using SQL SELECT statements.
- Retrieve data from tables of a database using SQL
SELECTstatements. - Use SQL operators with the
WHEREclause to set conditions on tables for data manipulation. - Utilize wildcard characters and other comparison operators for flexible data retrieval.
- Sort and limit query results while using SQL aliases for temporary naming.
- DataSpell: For integrated database query management.
- Docker: For containerizing the PostgreSQL database.
- DBeaver: For visual database interaction.
- PostgreSQL: As the database management system.
- Retrieve all data from the
employees,departments, andsalariestables.
- Retrieve specific data from a table using the
WHEREclause with conditions.
- Use
ANDandORoperators with theWHEREclause. - Understand operator precedence.
- Utilize
INandNOT INoperators.
- Retrieve data using
LIKEandNOT LIKEoperators with%and_wildcard characters.
- Use
BETWEENandIS NULL/IS NOT NULLoperators with theWHEREclause.
- Use equality (
=), inequality (<>,!=), greater than (>), less than (<), and their combinations.
- Retrieve distinct data from tables.
- Sort query results using
ORDER BY. - Limit the result set with
LIMIT. - Assign temporary names to columns using SQL aliases.
- SQL Files for Practice:
querying_databases.sql: Contains all the SQL queries used in the project.employee_excerpt.sql: Sample data to simulate theemployeesdatabase.
- Install PostgreSQL on your local machine.
- Load the provided
.sqlfiles into your PostgreSQL instance:- Use
psqlor DBeaver to execute the SQL files. - Ensure the database is correctly set up with the provided schema and data.
- Use
- Use any SQL client (e.g., DBeaver) to query the database using the examples provided in the SQL files.
SELECT * FROM employees;SELECT first_name, last_name, hire_date FROM employees;SELECT * FROM employees WHERE hire_date > '2000-01-01';SELECT * FROM employees WHERE dept_no = 'd003' AND hire_date <= '1999-12-31';SELECT * FROM employees WHERE first_name LIKE 'A%';After completing the tasks and quizzes outlined in this project, you can assess your understanding by attempting graded and ungraded quizzes. Ensure you score higher than 80% to earn a certificate of completion. I have successfully completed this course and earned the certificate.
Olayinka Imisioluwa Arimoro is a Data Scientist passionate about solving healthcare challenges with machine learning and deep learning techniques. His goal is to teach relevant skills for deriving business insights.
- Use the provided
.sqlfiles for practice. - Experiment with modifying the queries to explore the database further.
- Document your learning journey and insights in the repository.
This repository is open for educational purposes. Feel free to use, modify, and share with proper attribution.
Happy querying! 🚀