MySQL must know the notes

Source: Internet
Author: User

Long time no write.

1:show columns from table, the same as describe table shows the structure of the table. The SELECT * FROM table displays the data inserted in the entire table.

2:select distinct c1,c2 from table unless the columns are different, all rows are retrieved, that is, you cannot use distinct for some columns

3: The retrieved data is not displayed in a purely random order, and if not sorted, the data is typically displayed in the order in which it appears in the underlying table. To sort the clauses retrieved by SELECT, you can use the Order by+ column name. The column name is not necessarily the column to display, and the non-retrieved column sort is also perfectly legal. When sorting by more than one column, the order in which the columns appear after order BY, the other column is sorted under the same value only if more than one row in the preceding column has the same value. The default ASC is in ascending order. If you sort multiple columns, add desc after each column. You can use the order by and limit combinations to find the highest or lowest value in a column. In addition, the order by must be located after the FROM clause and the limit must be after the order by.

4: When using both the order BY and WHERE clauses, you should have order by in the Where. MySQL is not case-sensitive by default when performing a match, so fuses and fuses in the WHERE clause match. The WHERE clause qualifies the string with single quotation marks, and if the value is compared to a column of type string, you need to limit the quotation marks to the value that is used to compare with the numeric column.

where price between 5 and between all values in the matching range include the start value and the end value.

The 5:where clause is used in conjunction with and or in. Where and teaches or has a higher priority, it is recommended that parentheses be used in the WHERE clause. In (&,&) equals or

6: Wildcard:% indicates any number of occurrences of any character. But be sure to note the trailing blanks. Although the% seems to match anything, it cannot match the line with the value NULL as the product name. _ matches only a single character.

MySQL must know the notes

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.