当前位置:网站首页>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

以上为今天的视频笔记,如有侵权请联系我删除.
学习如逆水行舟,不进则退.和小吴一起加油吧!
边栏推荐
- Flink集群搭建
- Recycling rental system 100% open source without encryption Mall + recycling + rental
- 51.【结构体初始化的两种方法】
- 网络水军第一课:手写自动弹幕
- 用户体验 | 如何度量用户体验?
- Based on php animation peripheral mall management system (php graduation design)
- LeetCode952三部曲之二:小幅度优化(137ms -> 122ms,超39% -> 超51%)
- 基于php湘西旅游网站管理系统获取(php毕业设计)
- 基于php在线学习平台管理系统获取(php毕业设计)
- 基于php旅游网站管理系统获取(php毕业设计)
猜你喜欢

Image fusion GANMcC study notes

递归(各经典例题分析)

LVS负载均衡群集

shell specification and variables

基于php湘西旅游网站管理系统获取(php毕业设计)

FusionGAN:A generative adversarial network for infrared and visible image fusion文章学习笔记

render-props and higher order components

ImportError: `save_weights` requires h5py. Problem solved

【牛客刷题-SQL大厂面试真题】NO4.出行场景(某滴打车)

教你VSCode如何快速对齐代码、格式化代码
随机推荐
Based on php online examination management system acquisition (php graduation design)
高等代数_证明_矩阵的行列式为特征值之积, 矩阵的迹为特征值之和
FusionGAN:A generative adversarial network for infrared and visible image fusion文章学习笔记
The Microsoft campus ambassador to shout you to autumn recruit!
小程序--分包
XSS漏洞
ImportError: `save_weights` requires h5py. Problem solved
树莓派的信息显示小屏幕,显示时间、IP地址、CPU信息、内存信息(c语言),四线的i2c通信,0.96寸oled屏幕
KMP 字符串匹配问题
SAP ABAP OData 服务如何支持删除(Delete)操作试读版
如何防范 DAO 中的治理攻击?
【C语言实现】求两个整数的较大值
Spark练习题+答案
关于npm的那些事儿
感觉自己好傻
ModuleNotFoundError: No module named 'yaml'
微软校园大使喊你来秋招啦!
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.1 The Prehistoric Phase of the C Language
RecycleView的使用
熟悉的朋友