Skip to content

Latest commit

 

History

History

README.md

0x0D. SQL - Introduction

Tasks

Task file Description
0. List databases 0-list_databases.sql lists all databases of the MySQL server.
1. Create a database 1-create_database_if_missing.sql creates the database hbtn_0c_0
  • If the database hbtn_0c_0 already exists, your script should not fail
2. Delete a database 2-remove_database.sql deletes the database hbtn_0c_0
  • If the database hbtn_0c_0 doesn’t exist, your script should not fail
3. List tables 3-list_tables.sql lists all the tables of a database
  • [note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
4. First table 4-first_table.sql creates a table called first_table in the current database.
first_table description:
  • id INT
  • name VARCHAR(256)
[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
5. Full description 5-full_table.sql prints the full description of the table first_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
6. List all in table 6-list_values.sql lists all rows of the table first_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
7. First add 7-insert_value.sql inserts a new row in the table first_table

New row:
  • id = 89
  • name = Best School
[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
8. Count 89 8-count_89.sql displays the number of records with id = 89 in the table first_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
9. Full creation 9-full_creation.sql creates a table second_table

second_table description:
  • id INT
  • name VARCHAR(256)
  • score INT

Your script should create these records:
  • id = 1, name = "John", score = 10
  • id = 2, name = "Alex", score = 3
  • id = 3, name = "Bob", score = 14
  • id = 4, name = "George", score = 8

  • [note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
10. List by best 10-top_score.sql lists all records of the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
11. Select the best 11-best_score.sql lists all records with a score >= 10 in the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
12. Cheating is bad 12-no_cheating.sql updates the score of Bob to 10 in the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
13. Score too low 13-change_class.sql removes all records with a score <= 5 in the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
14. Average 14-average.sql computes the score average of all records in the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
15. Number by score 15-groups.sql lists the number of records with the same score in the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)
16. Say my name 16-no_link.sql lists all records of the table second_table

[note]: The database name will be passed as argument of mysql command (in the following example: mysql is the name of the database)