当前位置:网站首页>Getting Started Database Days4
Getting Started Database Days4
2022-08-01 21:47:00 【Xiao Wu has an idea】
- 学习视频【韩顺平讲MySQL】零基础一周学会MySQL -sql mysql教程 mysql视频 mysql入门_哔哩哔哩_bilibili
- 萌新入门,如有错误恳请各位大佬指点,不甚感激
目录
日期函数
例:返回当前日期
例:返回当前时间

例:返回当前时间戳

例:

Create a news sheett77
1:显示所有新闻信息,发布日期只显示 日期,不用显示时间

2:查询在10分钟内发布的新闻

3:请在mysql 的 sql语句中求出 2011-11-11 和 1990-01-01 相差多少天

4:请用mysql 的sqlstatement to find out how many days you have lived now

5:如果你能活80岁,求出你还能活多少天


以上year,monthThe effect is to make it return only the year or month of the time
例:FROM_UNIXTIME() : 可以把一个unix_timestamp 秒数,转成指定格式的日期


意义:在开发中,可以存放一个整数,然后表示时间,通过FROM_UNIXTIME转换
加密函数
例:查询用户


例:查询当前使用数据库名称
![]()
例:MD5(str) 为字符串算出一个 MD5 32 的字符串,常用(用户密码) 加密
----root 密码是 hsp-> 加密md5 -> 在数据库中存放的是加密后的密码
The general query user is written as follows
PASSWORD(str) 加密函数,MysqlThe user password for the database is its encryption
例:

从原文密码str计算并返回 密码字符串
![]()
流程控制函数
IF(expr1,expr2,expr3) 如果expr1为true,则返回expr2,否则返回expr3

IFNULL(expr1,expr2) 如果expr1不为空 NULL,则返回expr1,否则返回expr2
![]()

例:先创建一个emp表

1.查询emp表,如果comn是null,则显示0.0


2.如果表的job是clerk,则显示职员,如果是manager,则显示经理,如果是SALESMAN则显示销售人员,Others display normally

查询增强
例:查询2000A monster who joins after a year

例:Display initials ass的员工姓名和工资

例:Displays the third character as r的所有员工的姓名和工资

例:查询表的结构

例:Displays employee information in order of salary from lowest to highest

例:按照部门号升序而雇员的工资降序排列,显示雇员信息

分页查询
SELECT * FROM t99
ORDER BY t99
LIMIT 每页显示记录数*(第几页-1),每页显示记录数



分组增强
例:

例:统计没有获得补助的雇员数


例:Displays the total number of administrators
错误写法:

这里有两个7698
正确写法:去重


例:Displays the maximum difference in wages

例:统计各个部门group by 的平均工资avg,并且是大于1000的having,并且按照平均工资从高到低排序,order by,取出前两行记录 limit 0, 2

以上为今天的视频笔记,如有侵权请联系我删除.
学习如逆水行舟,不进则退.和小吴一起加油吧!
边栏推荐
- Spark练习题+答案
- 今年的很美味
- SOM网络2: 代码的实现
- MySQL related knowledge
- 基于php在线音乐网站管理系统获取(php毕业设计)
- ModuleNotFoundError: No module named ‘yaml‘
- Jmeter combat | Repeated and concurrently grabbing red envelopes with the same user
- 安全第五次课后练习
- 用户体验 | 如何度量用户体验?
- Based on php online learning platform management system acquisition (php graduation design)
猜你喜欢
随机推荐
小程序--分包
模拟数据之mockjs
Dichotomy Medium LeetCode6133. Maximum Number of Groups
漫长的投资生涯
C Pitfalls and Defects Chapter 7 Portability Defects 7.7 Truncation During Division
Scala practice questions + answers
Based on php online examination management system acquisition (php graduation design)
Appendix A printf, varargs and stdarg A.3 stdarg.h ANSI version of varargs.h
越长大越孤单
方舟生存进化是什么游戏?好不好玩
File operations of WEB penetration
scikit-learn no moudule named six
Based on php animation peripheral mall management system (php graduation design)
上传markdown文档到博客园
Image fusion GANMcC study notes
ModuleNotFoundError: No module named 'yaml'
0DFS Medium LeetCode6134. Find the closest node to the given two nodes
教你VSCode如何快速对齐代码、格式化代码
LeetCode952三部曲之一:解题思路和初级解法(137ms,超39%)
【C语言实现】两种计算平均成绩题型,博主精心整理,值得一读









