MySQL is a relational database management system, its small size, speed, the total cost of ownership is low, and open source, the general development of small and medium Web sites have chosen MySQL as a website database.
here, the MySQL installation is not much said, after installation, MySQL is the use of command-line interface to operate, which for many programmers are not accustomed to, this requires visual tools to operate on MySQL. MySQL has a lot of visual tools, the author is using Workbench, here on how to create a workbench database and tables for a simple demo.
Open Workbench as shown below, click the red box and log in.
Enter the user interface after entering a password.
Click the 1 button to create the database, the 2 interface, enter the database name, click 3 to Apply, create the database.
When the database is created, the database that you just created is displayed on the left
Right-select Create Table on tables
Click the CREATE table to appear on the right side of the interface, design the table.
The red box area is the column name and data type of the design table.
(PK, NN, etc. express meaning please look down, write at the end)
Click on the bottom right to create the table successfully.
Once created, you will be able to create a table under tables, right-click on the table name, select Select Rows to insert data into tables, and select Alter tables to redesign the table.
Now let's talk about the meaning of PK and nn mentioned above
Pk:primary Key Primary
Nn:not NULL non-null
Uq:unique only
Bin:binary binary (larger than text)
un:unsigned unsigned number (non-negative)
Zf:zero Fill Zero, for example, the design column type is int (4), and when the table is created, the input field is 1, then the automatic padding is 0001
Ai:auto Increment Self-increasing