当前位置:网站首页>SQL practice
SQL practice
2022-08-06 05:14:00 【north street style】
1. The DATEDIFF() function returns the time between two dates.

The syntax of the DATEDIFF() function in MySQL is DATEDIFF(date1,date2), which returns the number of days between two dates
2. distinct deduplicate data
select distinct name, id from A
The result after execution is as follows:

Actually, the deduplication is based on the two fields of name and id. This method is supported by both Access and SQL Server.
3. Aggregated data
The execution process of the sql statement is: from-->where-->group by -->having --- >order by --> select; The aggregation function is performed for the result set, but where is the query resultThe result set is filtered before, so when the aggregation function is used together with where, an error will occur. Having is for filtering the result set, so the aggregation function is matched with group by, and having is used instead of where. Having generally follows group by.
边栏推荐
猜你喜欢
随机推荐
Responsive dream weaving template enterprise group website
fegin feign.FeignException: status 404 reading StudenService#getAll()
MySQL - 可重复读隔离级别在哪种情况下会出现幻读
金属材料/多肽/多糖/化合物/抗体/量子点/黑磷量子点修饰水凝胶
mogdb和mogha开源吗?
从云计算到函数计算
百度智能云数字人凭什么领跑中国AI数字人?
Industrial Robot Review Questions
Remove data that exceeds the maximum number of specified List
Clion设置toolchains报错
YGG 与《元素突击》的创造者游戏平台 G4AL 达成合作
苏三说:今年测试行业企业招聘的真相
golang 中 map 排序
【C语言数组下标越界】数组下标越界引发的死循环
使用JacORB编译idl文件生成依赖的开发jar---Corba北向接口开发001
matlab 离散无记忆信源建模
进程初识
Practical debugging tips
想完全掌握Swagger,这一篇就够了!
数据库系统原理与应用教程(079)—— MySQL 练习题:操作题 181-185(二十三):综合练习









