SQL syntax, SQL
SQL refers to the structured query language.
The following is a table named "Persons": id auto-increment, no need to worry
Basic SQL statements include addition, deletion, modification, and query.
Add: The insert into statement is used to INSERT new rows INTO the table.
Insert into table name VALUES (value 1, value 2 ,....)
You can also specify the columns to insert data:
Insert into table_name (column 1, column 2 ,...) VALUES (value 1, value 2 ,....)
Example: insert into persons values ('J', 'yc', 'cn', 'qingdao ')
Insert into persons (address, city) values ('cn', 'beijing ')
DELETE: The DELETE statement is used to DELETE rows in a table.
Delete from table name WHERE column name = Value
Delete from persons where city = 'beijing'
Delete all rows
DELETE * FROM table_name
Change: UPDATE table name: SET column name = new value: WHERE column name = A Value
Update persons set address = 'usa' where city = 'beijing'
Update several columns in a row
Update persons set address = 'USA ', lastname = 'J' where city = 'beijing'
Query: SELECT column name FROM Table Name
Select address from persons
Select all columns from the table
Select * from persons
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.