-------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)