114532 Views
101685 Views
86270 Views
54891 Views
51137 Views
49962 Views
Level Up your CAD Skills
Operation Pico
Raspberry Pi Home Hub
Hacky Temperature and Humidity Sensor
Robot Makers Almanac
High Five Bot
Using the Raspberry Pi Pico's Built-in Temperature Sensor
Getting Started with SQL
Introduction to the Linux Command Line on Raspberry Pi OS
How to install MicroPython
Wall Drawing Robot Tutorial
BrachioGraph Tutorial
KevsRobots Learning Platform
100% Percent Complete
By Kevin McAleer, 5 Minutes
In this lesson, we’ll review the key topics covered in this course and introduce a final project that lets you apply everything you’ve learned to a real-world scenario.
Over the past lessons, you’ve built a strong foundation in SQL, covering the following key concepts:
SELECT
INSERT
UPDATE
DELETE
WHERE
ORDER BY
LIMIT
AND
OR
CASE
GROUP BY
For this project, you’ll create a small database to manage sales data for a fictional company. This database will allow you to track customers, products, orders, and sales, applying the concepts and skills you’ve developed throughout the course.
Your database should include the following tables:
customer_id
name
email
join_date
product_id
product_name
price
order_id
customers
order_date
order_item_id
orders
products
quantity
total_price
quantity * price
Populate each table with sample data to test your queries. Include at least:
order_items
Use the following questions as prompts to write SQL queries and test your understanding:
SELECT * FROM customers WHERE join_date > DATE_SUB(NOW(), INTERVAL 1 YEAR);
SELECT * FROM products WHERE price > 50;
SELECT p.product_name, SUM(oi.total_price) AS total_sales FROM order_items AS oi JOIN products AS p ON oi.product_id = p.product_id GROUP BY p.product_name;
SELECT c.name, COUNT(o.order_id) AS order_count FROM customers AS c JOIN orders AS o ON c.customer_id = o.customer_id GROUP BY c.customer_id HAVING order_count > 1;
SELECT o.order_id, c.name, p.product_name, oi.quantity, oi.total_price FROM orders AS o JOIN order_items AS oi ON o.order_id = oi.order_id JOIN customers AS c ON o.customer_id = c.customer_id JOIN products AS p ON oi.product_id = p.product_id WHERE p.product_name = 'Laptop';
SELECT SUM(total_price) AS total_revenue FROM order_items;
customer_orders
CREATE VIEW customer_orders AS SELECT c.name, o.order_id, o.order_date FROM customers AS c JOIN orders AS o ON c.customer_id = o.customer_id;
CREATE INDEX idx_order_date ON orders (order_date);
If you’re ready for a challenge, try adding more complex requirements to your project:
discount
categories
Congratulations on completing the course! By now, you should have a solid foundation in SQL and relational database theory. You can:
This final project has helped you apply your skills to a practical scenario. Keep practicing, experiment with new datasets, and continue building on the concepts you’ve learned. SQL is a valuable skill that will serve you well across many projects and applications.
Thank you for participating in this course, and good luck with your SQL journey!
< Previous