当前位置:网站首页>mysql视图与索引
mysql视图与索引
2022-08-11 05:36:00 【Bugxiu_fu】
常见函数
注意:数据库函数必须要有返回值(一行一列)
数学函数
- round(num, 2):四舍五入,保留两位小数
- ceil(num):向上取整
- floor(num):向下取整
- truncate(num, 2):从小数点后两位直接截断,比如truncate(3.1415926, 3) = 3.141
- mod(num, 2):求余数 num % 2
日期函数
- str_to_date(“1997-06-03 19:23:12”, "%Y-%m-%d %H:%i:%s):通过后面的模式将前面的字符串进行转换成date格式
- date_format(“1997/6/3”, “%Y年%m月%d日”):将日期转为字符,1997年6月3日
视图
1.什么是视图
1) 视图是一种虚拟的表,是从数据库中一个或多个表中导出来的表。
2) 数据库中存放了视图的定义,而并没有存放视图中的数据,这些数据存放在原来的表中。
3) 使用视图查询数据时,数据库系统会从原来的表中取出对应的数据。
2.视图的作用1) 使操作简便化。
2) 增加数据的安全性。
3) 提高表的逻辑独立性。3.基本语法
CREATE VIEW 视图名 AS SELECT 语句;注意:视图创建成功的前提下时不能出现重复列
索引
1.什么是索引
索引是由数据库表中一列或多列组合而成,其作用是提高对表中数据的查询速度。
类似于图书的目录,方便快速定位,寻找指定的内容。2.索引的优缺点
优点:提高查询数据的速度。
缺点:创建和维护索引的时间增加了,同时占用硬盘空间。
边栏推荐
猜你喜欢
Multiscale communication in cortical-cortical networks
Douyin API interface
Spatial Pyramid Pooling -Spatial Pyramid Pooling (including source code)
每日sql-求2016年成功的投资总和
Taobao sku API interface (PHP example)
空间金字塔池化 -Spatial Pyramid Pooling(含源码)
MySQL导入导出&视图&索引&执行计划
The ramdisk practice 1: the root file system integrated into the kernel
已解决EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
HCIP OSPF/MGRE综合实验
随机推荐
WiFi Deauth 攻击演示分析 // mdk4 // aireplay-ng// Kali // wireshark //
HCIA knowledge review
矩阵分析——Jordan标准形
OA Project Pending Meeting & History Meeting & All Meetings
华为防火墙-1-安全区域
MySQL之函数
淘宝API常用接口与获取方式
Amazon Get AMAZON Product Details API Return Value Description
pytorch调整模型学习率
HCIP实验(pap、chap、HDLC、MGRE、RIP)
类的定义、类的继承以及super的使用
HCIP BGP建邻实验
Coordinate system in navigation and positioning
OA项目之我的审批(查询&会议签字)
华为防火墙-7-dhcp
redis + lua实现分布式接口限流实现方案
Top20括号匹配
My meeting of the OA project (meeting seating & review)
numpy和tensor增加或删除一个维度
Pinduoduo API interface (attach my available API)