Create, view, and insert MySQL Data Tables.

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.