Database Statement Learning

Source: Internet
Author: User

1. Query statements

 (1) Select column name, column name, ...

From table name: Setect * FROM table name get all contents in table

(2) Select DISTINCT column name, column name, ...

From table name//Get a different value for a column

(3) Select column name

From table name

Where column operator value//value if text format, use ' ', operator not equal to <>

And and or are used in the where statement to assemble multiple conditions.

Order BY Column name DESC/ASC//Sort result set DESC is descending, ASC is ascending

2. Inserting data into the table

(1) INSERT INTO form

Values (value 1, value 2, ...); You need to assign a value to each column in the table

(2) Insert into table (column name, column name, ...) )

Values (value 1, value 2, ...) You need to assign a value to an enumerated column name item

It is important to note that the key value must be unique

3. Modify the Tabular Data

Update table name

Set Column name = new value//corresponding column value

where column name = value//corresponding row

4. Delete rows from a table

Delete from table name

where Column name = value

Delete all rows Delete * FROM table name or delete from table name

5. Like operator and wildcard character

Where column name is like '//single quotation mark if you do not know the whole content can use a wildcard character

% can replace one or more characters, but be aware of where the% is placed

_ Can replace one character

[string] Any single byte in the string, and be aware of where it is placed

[! string] [^ string] non-string any one character//back two less

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.