SQL statement Knowledge points

Source: Internet
Author: User

1.SELECT selection
SELECT column name from table name
SELECT * FROM table name (select all columns)
SELECT SNO from SC
SELECT * from SC

2.DISTINCT lists different values, removing duplicate
SELECT DISTINCT column name from table name
SELECT DISTINCT SNO from SC

3.ORDER by sorting the result set
The default is ascending, or ASC, and you can use DESC if you want to be descending.
SELECT SNO from SC ORDER by CNO DESC
SELECT Sno,cno from SC ORDER by CNO Desc,sno ASC

4.INSERT Insertion
INSERT table Name values (value 1, value 2 ...) )
You can specify the inserted column INSERT INTO table_name (column 1, column 2 ...) Values (value 1, value 2 ....) )
INSERT SC VALUES (1,2,3,4)
INSERT into SC (sno,sno,name,age) VALUES (1,2,3,4)

5.UPDATE Modifying data
UPDATE table name SET column name = new value WHERE Column name = value
UPDATE person SET FirstName = ' Theron ' WHERE LastName = ' Wilson '
UPDATE person SET firstname= ' Theron ', age= ' WHERE LastName = ' Wilson '


6.DELETE Delete
DELETE from table name hwere column name = a value
DELETE from SC WHERE name= ' Theron '
DELETE from SC



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.