Database (sub-query, primary key, foreign key)

Source: Internet
Author: User

-------Sub-query------------
Select Bumen,count (*) as the number of people from the haha group by bumen have COUNT (*) >=5
Select MAX (nianling) from haha where bumen= ' sales department '
Select *from haha where bumen= ' sales department ' and nianling=56
--Summary
Select *from haha where nianling = (
Select MAX (nianling) from haha where bumen in (
Select Bumen from haha group by bumen have COUNT (*) >=5
)
)
and Bumen = (select bumen from haha group by bumen have COUNT (*) >=5)

--Find out all the oldest information in gay men--
Select MAX (xingming) from haha where Xingbie = ' Male '
Select *from haha where xingming = (select MAX (xingming) from haha where Xingbie = ' male ')

---The Paging code---,

Select top 5*from haha
Select top 5*from haha where code not in (select Top 5 code from haha)

--the page code, the front top represents how many data on a page, and the following code is the data that filters the previous page of the current page

--See how many pages a table can be divided into
Select Ceiling (COUNT (*)/5.0) from haha

Set PRIMARY KEY statement

Relationship-add-ellipsis after table and column specification

Click Confirm to finish.

Database (sub-query, primary key, foreign key)

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.