From 66ea77c0bbea83df29ba6feb0fdb66549529d47b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=8E=E5=86=A0=E5=AE=87?= Date: Tue, 24 Oct 2023 04:34:16 +0000 Subject: [PATCH] =?UTF-8?q?=E9=98=8E=E5=86=A0=E5=AE=87=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 阎冠宇 --- .../20231023 mysql\345\244\215\344\271\240.md" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "34\351\230\216\345\206\240\345\256\207/20231023 mysql\345\244\215\344\271\240.md" diff --git "a/34\351\230\216\345\206\240\345\256\207/20231023 mysql\345\244\215\344\271\240.md" "b/34\351\230\216\345\206\240\345\256\207/20231023 mysql\345\244\215\344\271\240.md" new file mode 100644 index 0000000..cd9a354 --- /dev/null +++ "b/34\351\230\216\345\206\240\345\256\207/20231023 mysql\345\244\215\344\271\240.md" @@ -0,0 +1,17 @@ +| --字符串 | | --字符串
length() -- 返回字符串长度,注意:一个汉字字符集长度是3
concat(x,y,...) -- 拼接所有字符串
concat_ws('符号',x,y,...) -- 指定连接符来拼接字符串
replace(str,x,y) -- 改字符串,将字符串str中的x改成y
left(str,x) --从x位置取str结果
right(str,x) --同理
substring_index(str,'分界字符',len) -- 返回从字符串str截取到第len个分界符的字符串,当len大于1时从左到右,小于1时从右到左

--日期函数
curdate() -- 返回当前日期
curtime() -- 返回当前时间
now() -- 返回当前时间日期
year(date) -- 获取指定date的年份
month(date) -- 获取指定date的月份
day(date) -- 获取指定date的日期 | +| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| | [5](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_5) | length() -- 返回字符串长度,注意:一个汉字字符集长度是3 | +| | [6](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_6) | concat(x,y,...) -- 拼接所有字符串 | +| | [7](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_7) | concat_ws('符号',x,y,...) -- 指定连接符来拼接字符串 | +| | [8](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_8) | replace(str,x,y) -- 改字符串,将字符串str中的x改成y | +| | [9](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_9) | left(str,x) --从x位置取str结果 | +| | [10](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_10) | right(str,x) --同理 | +| | [11](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_11) | substring_index(str,'分界字符',len) -- 返回从字符串str截取到第len个分界符的字符串,当len大于1时从左到右,小于1时从右到左 | +| | [12](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_12) | | +| | [13](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_13) | --日期函数 | +| | [14](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_14) | curdate() -- 返回当前日期 | +| | [15](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_15) | curtime() -- 返回当前时间 | +| | [16](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_16) | now() -- 返回当前时间日期 | +| | [17](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_17) | year(date) -- 获取指定date的年份 | +| | [18](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_18) | month(date) -- 获取指定date的月份 | +| | [19](https://gitee.com/class-04-grade-2022/database-advanced/pulls/968/files#b021cc51c07860148861dcce008f9c1f5cfe557e_0_19) | day(date) -- 获取指定date的日期 | \ No newline at end of file -- Gitee