Home > Database > Mysql Tutorial > body text

Detailed explanation of creation, viewing and inserting examples of MySQL data tables

零下一度
Release: 2017-06-28 10:25:55
Original
1692 people have browsed it
Data table: Data table (or table) is one of the most important components of the database and is the basis for other objects.
1. First, we open a database (here I open a newly created aaa database).
Open the database: use + database name;

##2. Start creating a table and name it tb1.
The rows are called records and the columns are called fields.
Create a table for name, age, salary
VARCHAR is the character type20 is the quantity limit of 20 characters
age is an integer type UNSIGNED means no negative number is required.
FLOAT(8,2) is an eight-digit integer, with two digits left after the decimal point. 00000000.00

View the database as exists):
SHOW DATABASES;
3. Next, check the structure of the data table:
SHOW COLUMNS FROM data table name;
The picture is the structure of the data table tb1 we just created, and all the data we set when we created it are displayed;

4. Insert the data and take a look:
First of all, the first method:
This kind The method must insert as much data as there are columns, and every column must have corresponding data.
Insert a name
Jack Age23 Salary2500.23 Person

The second method:
Insert a person whose nameRose’s salary is 65000.66. We have not inserted her age data here.
So this format can be inserted selectively.

5. Finally, check the data we inserted:
SELECT * FROM data table name;
(Rose did not insert age data, so it is Null)

Additional small functions:
View the currently opened database name: SELECT DATABASE()

##View all data tables in the database:

The above is the detailed content of Detailed explanation of creation, viewing and inserting examples of MySQL data tables. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template