思路:使用WHERE
关键字添加限定条件,并且注意用 AND
关键字添加多个限定条件
代码解释:从表user_profile
中取出列device_id
、gender
、age
、university
、gpa
,并添加限定条件:性别为男性、gpa大于3.5
SELECT device_id, gender, age, university, gpa FROM user_profile WHERE gender = 'male' AND gpa > 3.5
题目:https://www.nowcoder.com/practice/2d2e37474197488fbdf8f9206f66651c?tpId=199&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3DSQL%25E7%25AF%2587%26topicId%3D199