In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
The student numbers of all students whose scores in mathematics are higher than those in Chinese.
CREATE TABLE course (
Id int
Sid int
Course string
Score int
)
/ / insert data
/ / Field explanation: id, student number, course, grade
INSERT INTO course VALUES (1,1, 'yuwen', 43)
INSERT INTO course VALUES (2,1, 'shuxue', 55)
INSERT INTO course VALUES (3,2, 'yuwen', 77)
INSERT INTO course VALUES (4,2, 'shuxue', 88)
INSERT INTO course VALUES (5,3, 'yuwen', 98)
INSERT INTO course VALUES (6,3, 'shuxue', 65)
Seek: the student numbers of all students whose scores in mathematics courses are greater than those in Chinese courses.
Select sid,case when course= "yuwen" then score else 0 end as yuwen
Case when course= "shuxue" then score else 0 end as shuxue
From course
1 43 0
1 0 55
2 77 0
2 0 88
3 98 0
3 0 65
Select tmp.sid,Max (tmp.yuwen) as yuwen,max (tmp.shuxue) as shuxue
From (
Select sid,case when course= "yuwen" then score else 0 end as yuwen
Case when course= "shuxue" then score else 0 end as shuxue
From course
) tmp
Group by tmp.sid
1 43 55
2 77 88
3 98 65
Select stmp.sid
From (
Select tmp.sid,Max (tmp.yuwen) as yuwen,max (tmp.shuxue) as shuxue
From (
Select sid,case when course= "yuwen" then score else 0 end as yuwen
Case when course= "shuxue" then score else 0 end as shuxue
From course
) tmp
Group by tmp.sid
) stmp where stmp.shuxue > stmp.yuwen
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.