One of the keys to MySQL's success is its graphical interface phpMyAdmin which allows you to
This interface is developed in PHP and can easily be installed on a server. MySQL and phpMyAdmin are generally installed by default on most hosting or development environments.
MySQL queries are written in SQL which is a command line language that may seem austere at first. For a first use of MySQL, we are going to use phpMyAdmin. The latter displays the MySQL queries for each action performed in the graphical interface.
In general, access to the phpMyAdmin interface is done by the server address followed by phpMyAdmin: http://server_address/phpmyadmin. If you have installed a local server (like XAMPP). Your phpMyAdmin interface is generally accessible at one of these addresses: http://localhost/phpmyadmin or http://127.0.0.1/phpmyadmin.
If you do not have a phpMyAdmin installation on your server or your local machine, you can - as a last resort - perform the exercises on the demo interface of phpMyAdmin at this address: https://demo.phpmyadmin.net/master-config/ Please note that the databases are deleted and the privileges of users are reset at regular intervalles. As a courtesy to others users, do not modify the content of databases that do not belong to you not.
In the interface of phpMyAdmin, create a new database:
utf8mb4_unicode_ci
.The interface informs you that your database is empty (no table) and you suggests creating your first table.
In your database, create a stocks
table that contains 4 columns.
On the next page, define the fields of each column:
id
contains a unique identifier which will automatically increment with each new line (check the box AI
: Auto-Increment)designation
contains a string of 100 characters maximum which will contain the name of the articles.quatite
is an integer which indicates the quantity in stock.prix
contains a real which represents the price.Save and check the table:
The table is created and ready to use.
Browse
tab allows you to view the content of the table.Search
tab allows you to search for a row in the table.Insert
tab allows you to add rows to the table.Add a few lines into the table and observe the syntax of the SQL queries.
Always leave the id
field empty, it will automatically complete when
creating a new row.