This project focuses on advanced SQL concepts and their implementation in MySQL. You will learn about various topics such as creating tables with constraints, optimizing queries with indexes, using stored procedures, functions, views, and triggers in MySQL.
Before starting the project, make sure you understand the following concept:
- Advanced SQL
To successfully complete this project, you should read or watch the following resources:
- MySQL cheatsheet
- MySQL Performance: How To Leverage MySQL Database Indexing
- Stored Procedure
- Triggers
- Views
- Functions and Operators
- Trigger Syntax and Examples
- CREATE TABLE Statement
- CREATE PROCEDURE and CREATE FUNCTION Statements
- CREATE INDEX Statement
- CREATE VIEW Statement
By the end of this project, you should be able to explain the following topics without using external resources:
- How to create tables with constraints
- How to optimize queries by adding indexes
- What are stored procedures and functions in MySQL and how to implement them
- What are views in MySQL and how to implement them
- What are triggers in MySQL and how to implement them
- All files will be executed on Ubuntu 18.04 LTS using MySQL 5.7 (version 5.7.30)
- All files should end with a new line
- All SQL queries should have a comment just before
- All files should start with a comment describing the task
- All SQL keywords should be in uppercase (SELECT, WHERE, etc.)
- A
README.md
file, at the root of the project folder, is mandatory - The length of your files will be tested using
wc
To run the MySQL container, follow these steps:
- Use "container-on-demand" to run MySQL.
- Ask for the container with Ubuntu 18.04 - Python 3.7.
- Connect via SSH or WebTerminal.
- Start MySQL service in the container:
$ service mysql start * MySQL Community Server 5.7.30 is started
- Use the following command to import a SQL dump:
The above commands create a database
$ echo "CREATE DATABASE hbtn_0d_tvshows;" | mysql -uroot -p Enter password: $ curl "https://s3.amazonaws.com/intranet-projects-files/holbertonschool-higher-level_programming+/274/hbtn_0d_tvshows.sql" -s | mysql -uroot -p hbtn_0d_tvshows Enter password:
hbtn_0d_tvshows
and import a SQL dump into it.
Make sure to replace your_file.sql
with the actual name of your SQL file.
This project is authored by Guillaume Plessis, Senior Cloud & System Engineer at WeWork, and Guillaume, CTO at Holberton School.