
mysql相关
迷惘的小行星
这个作者很懒,什么都没留下…
展开
-
Mysql常用函数介绍
1.字符字节长度--获取字节长度 length 获取字符长度 char_lengthlength("张三") 4char_length("张三") 2length("zs") 2char_length("zs") 22.字段字符截取函数--截取center字段中索引从1到','前一个位置的字符,若','位置为19,则截取1-18select substr(center,1,instr(center,',')-1) from test;--截取center字段中索引从原创 2022-01-27 15:52:08 · 1147 阅读 · 0 评论 -
实用的SQL语句
1.如果t1表id字段等于t2表id字段,则令t1表的center字段等于t2表的center字段update t1 set center=(select center from t2 where t1.id=t2.id )where t1.id in (select id from t2);2.删除表中有问题的记录:本来正确记录的字段值应该是1,2;33,22;11,222;可是有些记录的字段值却是1,2;5;33,22; 要把有;5;的记录删除了(1) 先查出有问题的记录--正常来讲,原创 2022-01-27 14:46:17 · 1361 阅读 · 0 评论 -
如何查看两个相似数据库中一个数据库比另一个数据库多出的表
通过sql语句实现查找出两个数据库中不同的表 SELECT * FROM( SELECT table_name FROM information_schema. TABLES WHERE table_schema = 'geologic') AS aLEFT JOIN ( SELECT table_name FROM information_schema.TA...原创 2019-04-26 17:22:48 · 755 阅读 · 0 评论 -
mysql存储过程相关
查看所有的存储过程show procedure status where Db='databasename';查看存储过程的创建过程show create procedure 存储过程名;案例1如果最大日期和第二大日期不等,则更新表字段:drop procedure p_name;delimiter $$create procedure p_name()begindeclare first_dt varchar(32);declare sencond_dt varchar原创 2022-01-18 16:39:38 · 563 阅读 · 0 评论 -
Mysql使用过程中经常用到的SQL
1.创建表1.1普通表create table if not exists center_point_tmp_fqw(id int(11) comment '全局唯一id',org_id varchar(20) default null comment '组织id',center_point mediumblob comment '中心点',primary key (id)) engine=innodb default charset=utf8;1.2主键字段自增表create原创 2021-10-15 17:58:20 · 171 阅读 · 0 评论