Mysql Insert Into Statement
Mysql Insert Into Statement
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
2. If you are adding values for all the columns of the table, you do not need to specify
the column names in the SQL query. However, make sure the order of the values is in
the same order as the columns in the table. Here, the INSERT INTO syntax would be as
follows:
The selection from the "Customers" table will now look like this:
HTML
CSS JAVASCRIPT SQL PYTHON JAVASuitePHP
3B HOW TO W3.CSS C
Did you notice that we did not insert any number into the CustomerID field?
The CustomerID column is an auto-increment field and will be generated automatically
when a new record is inserted into the table.
The following SQL statement will insert a new record, but only insert data in the
"CustomerName", "City", and "Country" columns (CustomerID will be updated
automatically):
Example
The selection from the "Customers" table will now look like this:
CustomerID
Tutorials Exercises Services
CustomerName ContactName
Address City
Sign Up Log in
PostalCo
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
89 White Clover Karl Jablonski 305 - 14th Seattle 98128
Markets Ave. S.
Suite 3B
Exercise:
Insert a new record in the Customers table.
Customers
CustomerName,
Address,
City,
PostalCode,
Country
'Hekkan Burger',
'Gateveien 15',
'Sandnes',
'4306',
'Norway'
Tutorials
;
Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
Submit Answer »
COLOR PICKER
Tutorials Exercises Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C
FORUM ABOUT
W3Schools is optimized for learning and training. Examples might be simplified to
improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we
cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our terms of
use, cookie and privacy policy.
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C