Mys data operation F-rich

Source: Internet
Author: User
Tags custom name

  1. Add a row of data: INSERT into table name (List of column names: can be omitted) values (matches previous column name lists)
  2. Import data for a column from another table: Inset into table name (column name) Select column name from table name
  3. Modify the data for a row of columns: Update table name set column name = value, column name 1= value 1...where conditional statement; ignore WHERE clause modifies column Name column of entire table
  4. Delete a row of data: Delete from table name where conditional clause, Delete self-growth will not be restored, next time the data is inserted, it will grow, because the log will be recorded, the data will be restored
  5. Initialize table: TRUNCATE TABLE name
  6. Query data: Classification: 1, Projection operations: Specify the query structure to display those columns select *| column name from table Name 2, select action: Make those rows appear in the results where 3, arrange operations: show results in a certain order by
  7. Column alias: Column name as custom name
  8. Table aliases: Table name as custom name as can be omitted
  9. Splicing columns: Select concat (column name, column name) from table name
  10. Paging: Select *| list from limit num1,num2; NUM1 starting with NUM1 (integer), displaying num2 (integer) Rows
  11. Exclude duplicate data: Select DISTINCT column list from table name; Column Name list as a whole to go heavy
  12. Select data: =,<,>,<> equivalent not equal to combination: and or set relationship: in () satisfies parentheses, not in ()
  13. Fuzzy Search: SELECT field from table WHERE a field like condition

    1,%: Represents any of 0 or more characters. Can match any type and length of the character, in some cases, if Chinese, please use two percent sign (%).

    For example SELECT * from [user] WHERE u_name like '% three '

    will be u_name for "Zhang San", "Zhang Cat Three", "three-legged Cat", "Tang Sanzang" and so on Have "three" records all find out.

    Also, if you need to find a record of "three" and "cat" in U_name, use the and condition

    SELECT * FROM [user] WHERE u_name like '% three ' and u_name like '% cat% '

    If using SELECT * from [user] WHERE u_name like '% cat% '

    Although can search out "three feet cat", but can not search out the eligible "Zhang Cat three".

    2,_: Represents any single character. Matches a single arbitrary character, which is commonly used to restrict the expression's character-length statement:

    For example SELECT * from [user] WHERE u_name like ' _ Three _ '

    Only find "Tang Sanzang" so u_name for three words and the middle of a word is "three";

    Another example is SELECT * from [user] WHERE u_name like ' three __ ';

    Just find out "three-legged cat" so name is three words and the first word is "three"

Mys data operation F-rich

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.