当前位置:网站首页>SQL exam questions
SQL exam questions
2022-08-03 09:33:00 【Hip Hop∠※】
目录
考点1:in的用法
题目:现在运营想要找到学校为北大、复旦和山大的同学进行调研,请你取出相关数据.

select device_id,gender,age,university,gpa
from user_profile
where university in ("北京大学","复旦大学","山东大学")
考点2:or的用法
题目:现在运营想要找到学校为北大或GPA在3.7以上(不包括3.7)的用户进行调研,请你取出相关数据(使用OR实现)


select device_id,gender,age,university,gpa
from user_profile
where university = "北京大学" or gpa > 3.7
考点3:不为空
题目:现在运营想要对用户的年龄分布开展分析,在分析时想要剔除没有获取到年龄的用户,请你取出所有年龄值不为空的用户的设备ID,性别,年龄,学校的信息.

select device_id,gender,age,university
from user_profile
where
age !=""
# 第二种age is not null
考点4:does not contain an item
题目:现在运营想要查看除复旦大学以外的所有用户明细,请你取出相应数据

select device_id,gender,age,university
from user_profile
#where university !="复旦大学"
#where university not like "复旦大学"
where university not in ("复旦大学")
考点5:and和or
题目:现在运营想要找到gpa在3.5以上(不包括3.5)of Shandong University用户 或 gpa在3.8以上(不包括3.8)的复旦大学Students conduct user research,请你取出相应数据

select device_id,gender,age,university,gpa
from user_profile
where (gpa>3.5 and university="山东大学")
or (gpa>3.8 and university="复旦大学")
考点6:like模糊语句
题目:Now the operation wants to view all the universitieswith Beijing的用户的信息,请你取出相应数据.

select device_id,age,university
from user_profile
where university like ("%北京%")
#Including Beijing university like ("%北京%")
#以北京开头的 university like ("北京%")
# It ends with Beijing("%北京")
考点7:distinctGo heavy only
题目:现在运营需要查看用户来自于哪些学校,Please remove the school's from the user information sheet去重数据.

select distinct university from user_profile
考点8:Maximum and descending order(取第一行数据)
题目:Operations want to know复旦大学学生gpa最高值是多少,请你取出相应数据

法1:by descending order,然后取第一条
select gpa
from user_profile
where university = "复旦大学"
order by gpa DESC limit 1
法2:使用聚合函数取最大值
select max(gpa)
from user_profile
where university = "复旦大学"
边栏推荐
- DOM0、DOM2、DOM3 事件
- pytorch安装错误
- 基于百度AI和QT的景物识别系统
- Oracle 迁移至Mysql
- 删除文件夹时,报错“错误ox80070091:目录不是空的”,该如何解决?
- 2022最新整理软件测试常见面试题附答案
- 多媒体数据处理实验2:PCA
- 英文语法-状语从句
- Scrapy + Selenium implements simulated login and obtains dynamic page loading data
- STP普通生成树安全特性— bpduguard特性 + bpdufilter特性 + guard root 特性 III loopguard技术( 详解+配置)
猜你喜欢

Scrapy + Selenium implements simulated login and obtains dynamic page loading data

"Easy to use" websites that others don't know, make you more efficient

英文语法-状语从句

Redis实现分布式锁

MySQL 中 is null 和 =null 的区别

响应式布局经典范例——巨幅背景大标题

删除文件夹时,报错“错误ox80070091:目录不是空的”,该如何解决?

深度学习之 10 卷积神经网络2

Industry SaaS Microservice Stability Guarantee Actual Combat

MySQL的存储过程
随机推荐
Does setting the following sysctl settings require a system reboot?
What are pseudo-classes and pseudo-elements?The difference between pseudo-classes and pseudo-elements
慢 SQL 分析与优化
WinCheck Script
别人都不知道的“好用”网站,让你的效率飞快
阿里云·短信发送
English Grammar - Adverbial Clauses
System io statistics
ClickHouse删除数据之delete问题详解
Promise 二:关键问题
For heavy two-dimensional arrays in PHP
LINGO 18.0软件安装包下载及安装教程
Redis和MySQL如何保持数据一致性
Cartesi 2022 年 7 月回顾
013-Binary tree
【网络安全】Kail操作系统
MySQL8重置root账户密码图文教程
基于二次型性能指标的燃料电池过氧比RBF-PID控制
MySQL 中 is null 和 =null 的区别
selenium IDE的3种下载安装方式