SQL syntax, SQL

Source: Internet
Author: User

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.

Related Article

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.