Use of select (1)

Source: Internet
Author: User

 

Single Table operations
Select Name, Major, InDate from T_Employeeselect 12*12 select 12*12 as calculation result select Name as Name, Major, inDate from distinct * from distinct Nationality from T_Employee -- remove duplicate columns select * from T_Employee where GenderId = '403a0bd5-A304-4981-9535-ADA7AF2BFB51 'select * from T_Employee where GenderId = '403a0bd5-A304-4981-9535-ADA7AF2BFB51' and distinct mentid = '0da51809-hangzhou' select * from T_Employee where GenderId = '403a0bd5-A304-4981-9535-ADA7AF2BFB51 'or else mentid = '0da51809-hangzhou' and BirthDay like '2016'/* sort */select * from t_Employee where GenderId = '403a0bd5-A304-4981-9535-ADA7AF2BFB51 'or your mentid = '0da51809-hangzhou' and BirthDay like '000000' order by BirthDay asc -- select * from T_Employee where GenderId = '403a0bd5-A304-4981-9535-ADA7AF2BFB51 'or either mentid = '0da51809-hangzhou' and BirthDay like '000000' order by BirthDay desc -- sort in descending order select * from T_Employee where GenderId = '403a0bd5-A304-4981-9535-ADA7AF2BFB51' or required mentid = '0da51809-7C40-493E-8AB5-CF18EAA279DF 'and BirthDay like '000000' order by BirthDay asc, contractStartDay -- the default value is ascending/* group */select distinct mentid, AVG (BaseSalary) from T_Employee group by distinct mentid. The average value must be an average value, select primary mentid, AVG (BaseSalary) from T_Employee group by rollup (primary mentid) -- average value of all departments select EducationId, primary mentid, AVG (BaseSalary) from T_Employee group by rollup (EducationId, objective mentid) -- group the average value of the education status first, and then select EducationId, objective mentid, AVG (BaseSalary) from T_Employee group by cube (EducationId, receivmentid) -- Groups the average values of departments, then the average results, and then selects MAX (indate) for the average education status) from T_Employee where partition mentid = 'ade0f75a-period' select MIN (indate) from T_Employee where partition mentid = 'ade0f75a-quota' select avg (BaseSalary) from T_Employee where partition mentid = 'ade0f75a-5581-46C2-B3A5-F92B1D1E603B 'select sum (BaseSalary) from T_Employee where partition mentid = 'ade0f75a-Comment 'select top 3 Name from T_Employee where partition mentid = 'ade0f75a-Comment 'order by InDate descselect top 3 percent Name from T_Employee where partition mentid = 'inter- 5581-46C2-B3A5-F92B1D1E603B 'order by InDate desc/* having words */select GenderId, distinct mentid, MAX (indate) -- select fields must appear in group by or the aggregate function from T_Employee group by GenderId, optional mentidhaving GenderId = '34e1fd3a-EA46-4B80-9612-4014345C4CD2 '-- the filter condition must be selected from the select order by distinct mentid --, and the order by field also appears in the group by select GenderId, distinct mentid, MAX (indate) -- select fields must appear in group by or in the aggregate function from T_Employee group by GenderId, 1_mentidhaving MAX (indate)> = '2017-03-31 18:28:36. 427 '-- the filtering condition must be 'order by specified mentid' from 'select --, the order by field also appears in group by/* compute clause */select * from T_Employee where partition mentid = 'ade0f75a-5581-46C2-B3A5-F92B1D1E603B 'compute MAX (indate), min (indate ), sum (basesalary), avg (basesalary) select * from T_Employee where partition mentid = 'ade0f75a-quota' order by InDate compute MAX (indate), min (indate), sum (basesalary ), avg (basesalary) by indate -- corresponds to the order by sort./* where clause */select * from T_Employeewhere InDate between '2017-03-30 18:19:14. 503 'and' 2014-04-09 00:00:00. 000 'select * from T_Employeewhere BaseSalary % 10 = 0 select * from T_Employeewhere Name in ('data', 'data', 'not', 'classical style ') select * from T_Employeewhere Name not in ('data', 'local', 'not', 'classical style') select * from T_Employee

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.