Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Order of single table query

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Select sex, count (Sex) as count from tch_teacher where id > 15 group by Sex having count > 5 order by Sex asc limit 1

1-> from table: get the table tch _ teacher first

2-> where condition: filter the data set An according to the following criteria of where

3-> group by grouping: the filtered data An is grouped according to the columns after group by to get dataset B.

4-> having filtering: dataset B is further filtered to get dataset C.

5-> select data: here are four steps

Step 1: fetch data from dataset C according to the column names after select. Get dataset D

Step 2: deduplicate the data in dataset D (this step is established in the case of distinct in sql) to get dataset E.

Step 3: sort dataset E to get dataset F

Step 4: intercept data from dataset F to get the final dataset (perform limit 10 operation)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report