1. Recap
As you have may experienced, SQL is a pretty straight forward language. In the first unit, we executed basic data manipulation commands, specifically the sELEcT FROM table_name; statement. This SQL statement can be executed inside the terminal with the mysq1 interactive shell and statements can be sourced from a file with the source file-name . sql command as well.
Use semicolons
It's very important to remember that the use of ; semicolons whenever a SQL statement ends is part of the language syntax.
Query operators
The sELECT column name FROM table_name; statement can be complemented with the query operators which indicate comparisons, similarities or even regular expression patterns.
Getting help
Remember that you can get SQL help by executing the help contents ; inside the mysq1> shell.
2. What we'll learn
In the previous unit, the people database was already created. Let's learn how to create our own SQL relational database within the mysq1 shell as well as creating tables and rows with data.
Also, become more SQL savvy by:
Inspecting more SQL datatypes Knowing how to auto increment number values Knowing about the primary key, and the NOT NULL constraints Understanding data manipulation concepts better with the CRUD acronym
3. Resetting the unit's databases
If you make a mistake while editing any of the unit's databases or just want to reset the databases back to their original state, click the "Reset Database Section" button that is available in the relevant sections.
4.CRUD
As we learned in the previous SQL unit, there are 4 main data manipulation keywords:
: sELEcT for getting data from the specified table INSERT for inserting data into the specified table
DELETE for deleting data from the specified table
More often these 4 concepts are recognized with the CRUD acronym. The CRUD acronym is represented in the following table: CRUD SQL Data Manipulation Language (DML) Create equals the INSERT SQL keyword Read equals the SELECT SQL keyword Update equals the UPDATE SQL keyword Delete equals the DELETE SQL keyword In the following sections, we are going to create a guitars_collect ion database together with its table and begin to manipulate the data with the INSERT keyword. But first, complete the first challenge!
4. 1. Challenge
CRUD
Please select the correct answer and Check it! to have your answer assessed. If you are wrong. you will see the correct answer highlighted:
The CRUD acronym stands for:
0
Create, Refresh, Update and Delete
0
Create, Read, Update and Delete
Create, Run, Update and Duplicate
5. Creating SQL databases
Reset section database
If you make a mistake while editing the database in this section or just want to reset the database back to its original state, return to this page and click the "Reset Section Database" button below. Reset Section Database
SQL databases are sometimes called schemas. A database or schema can be created inside a mysq1 shell with the CREATE DATABASE database_name syntax. Let's create a guitars_collection database or schema by entering: mysql> CREATE DATABASE guitars_collectio