SQL Cookbook: Retrieving Records

Source: Internet
Author: User

1, where clause, and priority is higher than or

1 Select *  from where < Ten or  like ' %ark '  and = \g

is equivalent to the following query:

1 Select *  from where < Ten or  like ' %ark '  and = ) \g

2. Connection column value: concat

1 Select concat (" " as from Film\g

3. Use Case statements

1 Selecttitle,2  Case 3      whenLength<=  -  Then ' Short' 4      whenLength>  -  Then 'Long' 5 End 6  asInfo fromFilmwherefilm_id= 1\g

4. Randomly select N data

1 Select  from Order  by Rand 5\g

5. Find empty values

1 Select  from where  is NULL\g

Null to use is

6. Set default values for null values

1 Select COALESCE "'  as  from Film\g

SQL Cookbook: Retrieving Records

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.