Get the App
SLTechnology News&Howtos  ›  Database  › 

Manipulate data tables using T-SQL statements-insert data

Shulou Source: shulou.com Published: 2022-06-01 18:23:40 09月16日 Update

Insert data (insert) syntax:

Insert [into] [column name] values

Explanation:

Insert: it's a grammatical name, meaning to insert.

Into: it is optional and can be omitted.

The table name is required and which table needs to be added. If the table name is in Chinese, it should be expanded with English square brackets

Column names can be omitted, but the order in the subsequent values list is the same as the fields in the data table

Multiple column names and multiple value lists are separated by commas (English commas,)

Example:

Insert into [Information Table] (name, × × × number, home address, ~) values ('Zhang San', '123213213213' home address', ~)

Meaning:

Add a row of Zhang San information to the information table, and the order of the front columns is the same as the order of the data values behind.

Note:

1. Insert a whole row of data, not just half a row or several columns.

two。 The number of data values must be the same as the number of columns, and each data value type, precision, and decimal places must match the corresponding column.

The 3.insert statement cannot specify a value for an identifier column because its value grows automatically.

4. For character type columns, single quotation marks are required when inserting data.

5. If you specify that a column is not allowed to be empty when you design the table, the column must insert data or an error message will be reported.

6. Inserting data items is required to meet the requirements of the check constraint.

7. Although you can not specify a column name, you should get into the habit of explicitly specifying the inserted column and the corresponding value.

Tags: Data information order consistency address multiple family time type comma Zhang San English datasheet statement same good one line between items digits Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno MariaDB Shulou Tech Info Linux