Home > Database > Mysql Tutorial > How to add new records in mysql?

How to add new records in mysql?

青灯夜游
Release: 2020-10-09 14:52:41
Original
8923 people have browsed it

Mysql method to add new records: 1. Use the "INSERT INTO table name column name [, ... column name n] ] VALUES (value 1) [... , (value n);" statement; 2. Use "INSERT INTO table name SET column name 1 = value 1, column name 2 = value 2..." statement.

How to add new records in mysql?

(Recommended tutorial: mysql video tutorial)

MySQL data table is composed of rows and columns. Usually The "columns" of the table are called fields, and the "rows" of the table are called records.

After the database and table are successfully created, data needs to be inserted into the database table. In MySQL, you can use the INSERT statement to insert one or more rows of records into an existing table in the database.

Basic syntax

The INSERT statement has two syntax forms, namely the INSERT…VALUES statement and the INSERT…SET statement.

1) INSERT...VALUES statement

The syntax format of INSERT VALUES is:

INSERT INTO <表名> [ <列名1> [ , … <列名n>] ]
VALUES (值1) [… , (值n) ];
Copy after login

The syntax is described below.