SQL Statement Collation 1

Source: Internet
Author: User

the use of//case, as well as
SELECT CaseRegtype when 1 Then 'Monthly Card' when 0 Then 'Zhou Ka' when 2 Then 'Quarterly Card' when 3 Then 'Annual Card' ELSE 'Unknown card type' END as 'Card Type' fromSl_register_info

Left JOIN usage

 Left JOIN keyword Syntax SELECT column_name (s)  from table_name1  Left JOIN   on table_name1.column_name=leftJOINleft  OUTERJOIN.

When using a left join, the on and where conditions differ as follows:

1. On condition is the condition used when generating a temporary table, which returns records from the left table regardless of whether the condition on is true.

2. Where condition is the condition that the temporary table is filtered after the temporal table has been generated. At this point there is no left join meaning (must return the record of the table on the right), the condition is not true all filter out.

Extension: Right Join , full join,inner jion

Full has a set of attributes of left and right.

Inner Jion does not have this particularity (return intersection, equivalent to where)

The key reason is the particularity of the left Join,right Join,full join, regardless of whether the on condition is true will return records in the left or right table, and full has a set of attributes for left and right. and inner jion does not have this particularity, the condition is placed in and where, the result set returned is the same.

SQL Statement Collation 1

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.