Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/preston176/alx-backend-storage
https://github.com/preston176/alx-backend-storage
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/preston176/alx-backend-storage
- Owner: preston176
- Created: 2024-08-21T08:40:24.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-30T07:24:31.000Z (6 months ago)
- Last Synced: 2024-11-15T15:34:58.651Z (3 months ago)
- Language: Python
- Size: 1.21 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Concepts
For this project, we expect you to look at this concept:## Advanced SQL
### Resources
Read or watch:
- [MySQL cheatsheet](https://example.com/mysql-cheatsheet)
- [MySQL Performance: How To Leverage MySQL Database Indexing](https://example.com/mysql-performance)
- [Stored Procedure](https://example.com/stored-procedure)
- [Triggers](https://example.com/triggers)
- [Views](https://example.com/views)
- [Functions and Operators](https://example.com/functions-operators)
- [Trigger Syntax and Examples](https://example.com/trigger-syntax)
- [CREATE TABLE Statement](https://example.com/create-table)
- [CREATE PROCEDURE and CREATE FUNCTION Statements](https://example.com/create-procedure-function)
- [CREATE INDEX Statement](https://example.com/create-index)
- [CREATE VIEW Statement](https://example.com/create-view)### Learning Objectives
At the end of this project, you are expected to be able to explain to anyone, without the help of Google:#### General
- How to create tables with constraints
- How to optimize queries by adding indexes
- What is and how to implement stored procedures and functions in MySQL
- What is and how to implement views in MySQL
- What is and how to implement triggers in MySQL### Requirements
#### General
- All your files will be executed on Ubuntu 18.04 LTS using MySQL 5.7 (version 5.7.30)
- All your files should end with a new line
- All your SQL queries should have a comment just before (i.e. syntax above)
- All your files should start by a comment describing the task
- All SQL keywords should be in uppercase (SELECT, WHERE…)
- A README.md file, at the root of the folder of the project, is mandatory
- The length of your files will be tested using wc### More Info
#### Comments for your SQL file:
```
$ cat my_script.sql
-- 3 first students in the Batch ID=3
-- because Batch 3 is the best!
SELECT id, name FROM students WHERE batch_id = 3 ORDER BY created_at DESC LIMIT 3;
$
```#### Use “container-on-demand” to run MySQL
- Ask for container Ubuntu 18.04 - Python 3.7
- Connect via SSH
- Or via the WebTerminal#### In the container, you should start MySQL before playing with it:
```
$ service mysql start
* MySQL Community Server 5.7.30 is started
$
```#### List of databases:
```
$ cat 0-list_databases.sql | mysql -uroot -p my_database
Enter password:
Database
information_schema
mysql
performance_schema
sys
$
```#### In the container, credentials are root/root
#### How to import a SQL dump
```
$ 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:
$ echo "SELECT * FROM tv_genres" | mysql -uroot -p hbtn_0d_tvshows
Enter password:
id name
1 Drama
2 Mystery
3 Adventure
4 Fantasy
5 Comedy
6 Crime
7 Suspense
8 Thriller
$
```