Create and manipulate a database MySQL

SQL is a Structured Query Language used to communicate with a database server. We are going to browse all the useful commands in SQL.

SQL databases

First of all, we will access to MySQL on your system and list the different databases already present.

From this view, you will be able to consult different informations, including these two main functions :

List all the tables of the database on which you are connected.

List all the tables of the captured database.

Change the database.

Display the table’s structure contained in a captured database.

In the same way as SHOW COLUMNS, is is also possible to consult the table’s structure of your database :


CREATE is mainly used to create your databases and tables :

Do not display error if there is no database

Parameter of auto-incremation of an integer column.

Parameter of definition of the primary key of your table.

Parameter of obligation of value preventing any invalid capture.

Parameter of definition of default value if the provided value is invalid.

It is possible to create a table from the structure of an existing table, therafter we will see in details the element WHERE :


INSERT is used to add datas in your tables :

Please note that datas can be added in an order different from one of your table’s structure :


SELECT is used to search for datas in your tables :

Parameter of search condition.

Parameter of limit that displays y recordings from recording x.

Parameter to not display duplications.

Parameter of ASC ascending and DESC descending sorting.

It is possible to cumulate different search conditions thanks to comparison operators and AND and OR elements.
All the following comparison operators can be used :

Parameter of research where % replaces strings.


Not equal

Not equal

Greater than

Less than

Greater than or equal to

Less than or equal to

List of several possible values

Value within a given interval (useful for numbers or dates)

Value is null

Value is not null


UPDATE is used to upgrade datas in your tables.
We can search with the command WHERE just like we can do with the command SELECT :


ALTER is used to change a table’s structure, namely, the addition of one or several columns to your table, to change an existing column or to definitely delete it


DROP is used to definitely delete a database or a table :

Do not display error if there is no database.


DELETE is used to permanently delete recordings in the tables of your database or a table.
We operate our research with the command WHERE just like we do with the command SELECT :

Please try to never forget the command WHERE (usual mistake :)), that would lead to the loss of any table’s content.
It is also possible to clear a table and reset the meter auto_increment unlike DELETE :