当前位置:网站首页>SQL常见面试题目与答案整理
SQL常见面试题目与答案整理
2022-07-23 05:38:00 【我是女生,我不做程序媛】
海量数据如何优化SQL
根据执行计划(explain)设置合适的索引,选择合适的type(system最好,all最差)
数据库存储位置
数据库的数据文件和索引都储存在磁盘中;
每次查找数据都需要将索引文件读取到内存中
MySQL与hive
OLAP:在线分析处理,对应数据仓库hive,数据量大,不追求效率
OLTP:在线数据处理,对应数据库,数据量较小,追求效率
聚合函数和group by同时使用的字段限制
select 字段,聚合函数
from 表名
where 条件
group by 字段
这里select的字段要么包含在聚合函数中,要么包含在group by中,否则会出错。
聚合函数的嵌套使用
聚合函数不可以直接嵌套使用,但可以嵌套包含聚合函数的子查询。
错误:
select max(count(*)) from ...
正确:
select max(cnt) from(
select count(*) as cnt from...
)
边栏推荐
- adb常用命令
- JWT header进行编码过程
- Heidelberg CP2000 circuit board maintenance printer host controller operation and maintenance precautions
- 2. Analysis of the return value of the startup function
- 支付宝DTS架构
- Usage of countdownlatch
- mysql invalid conn排查
- Redis数据库和项目框架
- JDBC Learning and simple Encapsulation
- Deploy storageclass trample record
猜你喜欢
随机推荐
主从同步步骤读写分离+自遇错误分享
JDBC learning and simple encapsulation
9、光线追踪
【6.28】
大规模后台导出Excel无法并发
超级简单的人脸识别api 只需几行代码就可以实现人脸识别
Deploy storageclass trample record
混入视图基类
Master slave synchronization step read / write separation + self encountered error sharing
3DMAX first skin brush weights, then attach merge
[information system project manager] Chapter VI recheck schedule management knowledge structure
adb常用命令
img标签设置height和width无效
图片模糊处理批量生产模糊数据集
"The six programming languages I want most!"
Cadence (IX) 17.4 rules and spacing settings
idea中复制一个项目/project
Murata power maintenance switch server power maintenance and main functional features
H1--HDMI接口测试应用2022-07-15
同步发送短信验证码









