Create, view, and insert MySQL Data Tables.
Data Table: a data table (or table) is one of the most important components of a database and the basis of other objects. 1. First, open a database (here I open a new aaa database ). Open the database: use + database name; 2. Create a table with the table name tb1. Rows are called records and columns are called fields. Create a table named "name", "age", and "salary". The VARCHAR is of the character type. The value 20 indicates a maximum of 20 characters. The age is of the integer type. The value UNSIGNED indicates no negative number. FLOAT (8, 2) is an integer eight digits, and two digits are left after the decimal point. 00000000.00 view (database already exists): show databases;
3. Next, let's take a look at the structure of the data table: show columns from data table name. The figure shows the structure of the newly created data table tb1. All the data we set during creation is displayed; 4. insert data. First, the first method is to insert data into each column. Insert a person named Jack at age 23 with a salary of 2500.23. The second method is to insert a person named Rose with a salary of 65000.66. Here we didn't insert her age data. Therefore, this format can be selectively inserted. 5. Finally, check the inserted data: SELECT * FROM data table name; (Rose does not insert age data, so it is Null.) add a small function: view the name of the currently opened database: select database: