摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 22:44
anobscureretreat
阅读(665)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 22:27
anobscureretreat
阅读(377)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 22:21
anobscureretreat
阅读(3163)
评论(0)
推荐(0)
摘要:
如下,可以看到使用后,也统计了null的个数。 阅读全文
posted @ 2019-08-04 22:16
anobscureretreat
阅读(335)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 22:14
anobscureretreat
阅读(640)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 22:06
anobscureretreat
阅读(374)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 22:00
anobscureretreat
阅读(2166)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 21:52
anobscureretreat
阅读(10912)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 21:41
anobscureretreat
阅读(11496)
评论(0)
推荐(0)
摘要:
mysql> select * from table1 where minute(order_date)=46; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+-... 阅读全文
posted @ 2019-08-04 21:36
anobscureretreat
阅读(1034)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 21:29
anobscureretreat
阅读(3141)
评论(0)
推荐(0)
摘要:
mysql> select tan(pi()/4); +--------------------+ | tan(pi()/4) | +--------------------+ | 0.9999999999999999 | +--------------------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:25
anobscureretreat
阅读(269)
评论(0)
推荐(0)
摘要:
mysql> select pi(); +----------+ | pi() | +----------+ | 3.141593 | +----------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:24
anobscureretreat
阅读(1013)
评论(0)
推荐(0)
摘要:
mysql> select mod(16,3); +-----------+ | mod(16,3) | +-----------+ | 1 | +-----------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:21
anobscureretreat
阅读(2804)
评论(0)
推荐(0)
摘要:
mysql> select sqrt(16); +----------+ | sqrt(16) | +----------+ | 4 | +----------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:19
anobscureretreat
阅读(541)
评论(0)
推荐(0)
摘要:
mysql> select sin(PI()/6); +---------------------+ | sin(PI()/6) | +---------------------+ | 0.49999999999999994 | +---------------------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:18
anobscureretreat
阅读(568)
评论(0)
推荐(0)
摘要:
//获取pi 阅读全文
posted @ 2019-08-04 21:16
anobscureretreat
阅读(586)
评论(0)
推荐(0)
摘要:
mysql> select abs(3-5); +----------+ | abs(3-5) | +----------+ | 2 | +----------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:15
anobscureretreat
阅读(13483)
评论(0)
推荐(0)
摘要:
mysql> select exp(1); +-------------------+ | exp(1) | +-------------------+ | 2.718281828459045 | +-------------------+ 1 row in set (0.00 sec) 阅读全文
posted @ 2019-08-04 21:13
anobscureretreat
阅读(962)
评论(0)
推荐(0)
摘要:
mysql> select rand(); +--------------------+ | rand() | +--------------------+ | 0.9913473352709294 | +--------------------+ 1 row in set (0.00 sec) mysql> select rand()*100; +--------... 阅读全文
posted @ 2019-08-04 21:11
anobscureretreat
阅读(776)
评论(0)
推荐(0)
摘要:
mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | transactor | pid | order_date | +----------+------------+-----+---------------------+ | 1hah... 阅读全文
posted @ 2019-08-04 20:53
anobscureretreat
阅读(44327)
评论(0)
推荐(3)
摘要:
alter table table1 add order_date datetime null; mysql> select * from table1; +----------+------------+-----+------------+ | name_new | transactor | pid | order_date | +----------+------------+... 阅读全文
posted @ 2019-08-04 20:48
anobscureretreat
阅读(2907)
评论(0)
推荐(0)
摘要:
参考: https://www.yiibai.com/mysql/mysql_function_addtime.html 阅读全文
posted @ 2019-08-04 20:33
anobscureretreat
阅读(1164)
评论(0)
推荐(0)
摘要:
mysql> select adddate('1998-01-02', 31); +---------------------------+ | adddate('1998-01-02', 31) | +---------------------------+ | 1998-02-02 | +---------------------------+ 1 row ... 阅读全文
posted @ 2019-08-04 20:32
anobscureretreat
阅读(751)
评论(0)
推荐(0)
摘要:
定义和用法 DATE_FORMAT() 函数用于以不同的格式显示日期/时间数据。 语法 date 参数是合法的日期。format 规定日期/时间的输出格式。 可以使用的格式有: 参考: https://www.w3school.com.cn/sql/func_date_format.asp 阅读全文
posted @ 2019-08-04 20:22
anobscureretreat
阅读(212)
评论(0)
推荐(0)
摘要:
mysql> select curtime(); +-----------+ | curtime() | +-----------+ | 19:43:34 | +-----------+ 1 row in set (0.00 sec) mysql> select time(now()); +-------------+ | time(now()) | +-------------+ |... 阅读全文
posted @ 2019-08-04 20:13
anobscureretreat
阅读(155)
评论(0)
推荐(0)
摘要:
参考: https://www.w3school.com.cn/sql/sql_dates.asp 阅读全文
posted @ 2019-08-04 20:11
anobscureretreat
阅读(170)
评论(0)
推荐(0)
摘要:
mysql> select dayofweek(curdate())-1; +------------------------+ | dayofweek(curdate())-1 | +------------------------+ | 0 | +------------------------+ 1 row in set (0.00 sec) ... 阅读全文
posted @ 2019-08-04 20:10
anobscureretreat
阅读(6823)
评论(0)
推荐(0)
摘要:
定义和用法 DATEDIFF() 函数返回两个日期之间的天数。 语法 date1 和 date2 参数是合法的日期或日期/时间表达式。 注释:只有值的日期部分参与计算。 参考: https://www.w3school.com.cn/sql/func_datediff_mysql.asp 阅读全文
posted @ 2019-08-04 20:09
anobscureretreat
阅读(569)
评论(0)
推荐(0)
摘要:
定义和用法 DATE_ADD() 函数向日期添加指定的时间间隔。 语法 date 参数是合法的日期表达式。expr 参数是您希望添加的时间间隔。 type 参数可以是下列值: 参考: https://www.w3school.com.cn/sql/func_date_add.asp 阅读全文
posted @ 2019-08-04 20:07
anobscureretreat
阅读(248)
评论(0)
推荐(0)
摘要:
当前表 根据发音查找内容 阅读全文
posted @ 2019-08-04 19:39
anobscureretreat
阅读(256)
评论(0)
推荐(0)
摘要:
当前表: 选择出名字,并且转为大写 阅读全文
posted @ 2019-08-04 19:32
anobscureretreat
阅读(3507)
评论(0)
推荐(0)
摘要:
1 第一范式(1NF)在任何一个关系数据库中,第一范式(1NF)是对关系模式的基本要求,不满足第一范式(1NF)的数据库就不是关系数据库。所谓第一范式(1NF)是指数据库表的每一列都是不可分割的基本数据项,同一列中不能有多个值,即实体中的某个属性不能有多个值或者不能有重复的属性。如果出现重复的属性, 阅读全文
posted @ 2019-08-04 16:12
anobscureretreat
阅读(120)
评论(0)
推荐(0)
摘要:
1)范式优化: 比如消除冗余(节省空间。。) 2)反范式优化:比如适当加冗余等(减少join) 3)拆分表: 分区将数据在物理上分隔开,不同分区的数据可以制定保存在处于不同磁盘上的数据文件里。这样,当对这个表进行查询时,只需要在表分区中进行扫描,而不必进行全表扫描,明显缩短了查询时间,另外处于不同磁 阅读全文
posted @ 2019-08-04 15:35
anobscureretreat
阅读(244)
评论(0)
推荐(0)
摘要:
SQL语句优化 1)应尽量避免在 where 子句中使用!=或<>操作符,否则将引擎放弃使用索引而进行全表扫描。2)应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描,如:select id from t where num is null可以在n 阅读全文
posted @ 2019-08-04 14:30
anobscureretreat
阅读(178)
评论(0)
推荐(0)
摘要:
视图是虚拟的表,与包含数据的表不一样,视图只包含使用时动态检索数据的查询;不包含任何列或数据。 使用视图可以简化复杂的sql操作,隐藏具体的细节,保护数据;视图创建后,可以使用与表相同的方式利用它们。视图不能被索引,也不能有关联的触发器或默认值,如果视图本身内有order by 则对视图再次orde 阅读全文
posted @ 2019-08-04 14:11
anobscureretreat
阅读(1333)
评论(0)
推荐(0)
摘要:
数据库事务transanction正确执行的四个基本要素。ACID,原子性(Atomicity)、一致性(Correspondence)、隔离性(Isolation)、持久性(Durability)。原子性:整个事务中的所有操作,要么全部完成,要么全部不完成,不可能停滞在中间某个环节。事务在执行过程 阅读全文
posted @ 2019-08-04 14:10
anobscureretreat
阅读(462)
评论(0)
推荐(0)
摘要:
查询显示当前的隔离级别 设置隔离级别 查看隔离级别也可以(前提是知道具体变量名): 参考: https://www.jianshu.com/p/6738c4b11da8 阅读全文
posted @ 2019-08-04 13:31
anobscureretreat
阅读(14188)
评论(0)
推荐(0)
摘要:
详解: Read uncommitted A事务可以读取未提交事务B的数据 会出现的问题: 脏读: B事物修改数据a=1,但是没有提交,A事物读取数据a=1,A事物拿到数据后显示,此时B事物回滚,再次修改数据a=2,然后提交,所以实际数据a=2,但是A事物拿到的是a=1. Read committe 阅读全文
posted @ 2019-08-04 13:12
anobscureretreat
阅读(957)
评论(0)
推荐(0)
摘要:
原子性(Atomicity):一个事务要么都执行,要么都回滚(不可再分割) 一致性(Consistency):保证数据的状态操作前和操作后保持一致 隔离性(Isolation):多个事务同时操作相同数据库的同一个数据时,一个事务的执行不受另外一个事务的干扰 持久性(Durability):一个事务一 阅读全文
posted @ 2019-08-04 11:53
anobscureretreat
阅读(897)
评论(0)
推荐(0)

浙公网安备 33010602011771号