Share a self-written SQL statement

Source: Internet
Author: User
I am going to prepare for a review recently. Taking the MSSERVER2005 examination is a summary of the relevant SQL statements. Generally, I have not written any frequently-used SQL statements, which may be used and are not frequently used, however, it is not unnecessary syntax, and we hope to use the SQL statement SELECTDISINCT (student ID) for everyone. The level of CASEWHEN total credits 50THEN pass WHEN total credits 80THEN is good ELS

I am going to prepare for a review recently. Taking the MSSERVER2005 examination is a summary of the relevant SQL statements. Generally, I have not written any frequently-used SQL statements, which may be used and are not frequently used, however, it is not unnecessary syntax. I hope to use the SQL statement SELECT DISINCT (student ID). The level = CASEWHEN total credits: 50 then' pass 'when total credits: 80 then' is good 'els

I am going to prepare for a review recently. Taking the MSSERVER2005 examination is a summary of the relevant SQL statements. Generally, I have not written any frequently-used SQL statements, which may be used and are not frequently used, however, it is not unnecessary syntax. I hope to use SQL statements for you.
Select disinct (student ID), grade = CASEWHEN total credits> 50 then' pass 'when total credits> 80 then' good 'else' excellent 'end, TOP (5) [PERCENT] INTO tb_name_otherFROM tb_name cross join tb_second_nameWHERE th_colnum = 'xxxx' AND name LIKE '% Wang # _ % 'escape' # 'AND major IN ('computer', 'soft ', 'communication') AND birthday not between 'a 'AND' B 'AND INS ins (*, 'project') AND FREETEXT (*, 'job ') group by expression with cube/with rolluphaving expressionORDER BY expressionCOMPUTE COUNT (student ID) BY professional union all select * FROM tb_third_name WHERE student ID = 'xxxx' before t/intersect select * FROM tb_forth_name WHERE gender = '1' (cannot be used with the COMPUTE clause)

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.