T-SQL statement written by six people together

Source: Internet
Author: User

Requirement Description:

1. The company has 10000 people

2.1980 were born in 3000

3. more than 5000 of employees earn 3000 yuan.

4.1980 of employees born in 5000, with a salary of more than 1000 million

Query the list of employees with a salary of more than 1980 who were born in 5000

The following is written by the six students:

 

1 -- Table employee
2 -- Birthdate birth, type: datetime
3 -- Wage wage, type: decimal)
4 -- Name empname, type: navarchar (20)
5 -- 01
6 Select Empname From Employee
7   Where Birth = " 1980 " And Wage = " 6000 "
8 -- 02
9 Select Empname From Employee
10   Where Birth = " 1980 " And Wage > 5000
11 -- 03
12 Select Empname From Employee
13   Where Birth =   ' 1980 '   And Wage > 5000
14 -- 04
15 Select Empname From Employee
16   Where Birth Datetime   =   ' 1980 '   And Wage > 50
17 -- 05
18 Select Empname From Employee
19   Where Birth Like   ' 1980% '   And Wage > 5000
20 -- 06
21 Select Empname From Employee
22   Where Birth Like   ' % 1980% '   And Wage > 5000

 

In fact, I want someone to write such a statement:

 

1 Select Empname From Employee
2   Where   Year (Birth) =   1980   And Wage > 5000

 

Of course, you do not want to write such a statement:

 

1 Select Empname From Employee
2   Where Wage > 5000   And   Year (Birth) =   1980

 

It is worth pondering!

 

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.