SQL Step-by-Step (5) inserting data into a table

Source: Internet
Author: User
Tags insert table name

Inserting data into a table

Insert statements are used to insert or add a row of data to a table in the form of:

INSERT INTO "tablename"

(First_column,... Last_column)

VALUES (First_value,... last_value);

[] = optional

As a simple example:

INSERT INTO employee

(The last, the age, the address, the city)

VALUES (' Luke ', ' Duke ', ', ' 2130 boars Nest ', ' Hazard Co ');

Note here: Each character should be surrounded by single quotes.

To insert data into a table, follow the keyword INSERT into the table name, then the left parenthesis, followed by a comma-separated list of column names, a closing parenthesis, followed by a series of values enclosed in parentheses after the keyword values. These values are the data you want to fill in the table, and they must match the specified column name. String translations are enclosed in single quotes and numbers are not used. In the example above, ' Luke ' must match column A, and 45 must match the column age.

If you want to insert the following data into the employee table;

Zhang weiguo,28, Beijing 601 P.O. Box, Beijing

Then you need to use the following SQL statement:

INSERT INTO employee

(The last, the age, the address, the city)

VALUES (' Zhang ', ' Weiguo ', 28, ' Beijing 601 box ', ' Beijing ');



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.