[数据库]mysql
零点零一
Make it right before you make it faster. Keep it right when you make it faster. Make it clear before you make it faster. Do not sacrifice clarity for small gains in efficiency. -- Brian Kernighan
展开
-
如何在MySQL中使用触发器?MySQL触发器详解
中创建触发器、控制触发器的执行时间、事件和流程控制、优化触发器等内容。使用触发器可以实现复杂的业务逻辑,提高数据库的性能和可靠性。使用触发器的执行条件和流程控制语句来控制执行流程,避免触发器不必要的执行。是一个常用的关系型数据库管理系统,支持触发器的使用。中,触发器可以使用流程控制语句来控制程序的执行流程,例如。中的一种特殊的存储过程,它可以在特定的表上执行一系列的。中的一种特殊的存储过程,它可以在特定的表上执行一系列的。尽量减少触发器的执行时间,避免触发器变得庞大和复杂。触发器的执行时间可以是。转载 2023-07-27 16:53:37 · 988 阅读 · 0 评论 -
mysql的表中有自增id的如何插入数据
mysql的表中有自增id的如何插入数据1、把每一个字段都写出来就没有这个问题了。例如:insert into userInfo(name,password) values('ddf','8979');2、如果字段好多好多的时候不想一一写字段,使用如下方法:例如:insert into userInfo values(null,'ddf','8979');insert into userInfo values(0,'ddf','8979');参考:https://www.c转载 2022-03-01 13:48:54 · 3982 阅读 · 0 评论 -
mysql更新A表的字段等于B表的字段
SELECT 1_12V, 1_5V, 2_SW_CAN_PULSE_V,2_Xave, 2_Yave, 2_Zave,2_ZaveGyro,8_SLEEP_5S_mA, 8_DEEP_SLEEP_mA FROM table_32f1__20210820SELECT 1_12V, 1_5V, 2_SW_CAN_PULSE_V,2_Xave, 2_Yave, 2_Zave,2_ZaveGyro,8_SLEEP_5S_mA, 8_DEEP_SLEEP_mA FROM table_32f1__20210.原创 2021-09-14 16:56:07 · 1479 阅读 · 0 评论 -
MYSQL 字符串替换,字符串后追加字符串
表table字段sn的 “20550000001”中的205500替换为ND100update tableset SN = replace(SN,"205500","ND100")ysql 往表中某个字段的字符串后追加字符串update 表名 set 字段名=CONCAT(字段名,"需添加的值")WHERE 条件列如:update np_order set customer_remark=CONCAT(customer_remark,"sgja那里能的可能")WHERE order_..原创 2020-11-03 09:13:18 · 1116 阅读 · 0 评论 -
mysql 语句将指定列的浮点数转化为整数:
mysql 语句将指定列的浮点数转化为整数:例子:SELECT tableName, COUNT(*) FROM fieldName GROUP BY fieldNameUPDATE tableName SET fieldName = fieldName/1000 WHERE fieldName >1000语句将指定列的浮点数转化为整数的语句:update tableNa...原创 2019-12-20 09:29:50 · 2410 阅读 · 0 评论 -
在网上搜集的 mysql 修改表 的方法 删除,添加,修改表字段等
Mysql修改表 删除,添加或修改表字段删除ALTER TABLE testalter_tbl DROP i;新增ALTER TABLE testalter_tbl ADD i INT;指定位置新增ALTER TABLE testalter_tbl DROP i;ALTER TABLE testalter_tbl ADD i INT FIRST;ALTER TABL...原创 2019-11-12 09:50:29 · 262 阅读 · 0 评论 -
mysql查看所有触发器以及存储过程等操作集合
mysql查看所有触发器以及存储过程等操作集合今天在做每个月定时扣费的功能 用到了Mysql的Event Scheduler昨完之后发现一个问题 Event Scheduler 默认是不开启的 要在mysql内执行SET GLOBAL event_scheduler=on;重启服务之后 测试发现 事件还是未被调用 ,然后在执行SHOW VARIABLES LIKE 'event_s...转载 2019-10-23 09:46:34 · 1069 阅读 · 0 评论 -
MySql数据库细节使用规范详细解读胜过千行代码优化
版权声明:本文为CSDN博主「乐杨俊」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/leyangjun/article/details/55509724适用场景:并发量大、数据量大的互联网业务一、基础规范(1)必须使用InnoDB存储引擎解读:支持事务、行级锁、并发性...转载 2019-10-23 09:45:13 · 267 阅读 · 0 评论 -
SQL语句记录
两表交叉查询操作的例子:DELETE FROM table1 WHERE keyWord in (SELECT keyWord FROM table2 )原创 2019-10-10 18:39:51 · 155 阅读 · 0 评论 -
mysql 语句修改增加字段属性唯一性,主键,自增等
我在找该项资料的时候,是要为一个表的字段增加唯一性的属性经查阅,我使用了alter table ATablemodify column PoTable varchar(100) UNIQUE KEY NOT NULL;语句执行,总结一点,在修改这个字段的时候,要把这个字段的原来的属性都再写一遍.不然也许会有变化.我最后查询到如下夏新SET FOREIGN_KEY_CHECKS=...原创 2019-09-09 10:25:23 · 3353 阅读 · 0 评论 -
MySQL添加字段、修改字段、删除字段、 获取表名、获取字段名的sql语句
MySQL添加字段和修改字段MySQL添加字段的方法并不复杂,下面将为您详细介绍MYSQL添加字段和修改字段等操作的实现方法,希望对您学习MySQL添加字段方面会有所帮助。1添加表字段alter table table1 add transactor varchar(10) not Null;alter table table1 add id int unsigned n...原创 2019-06-17 09:33:53 · 120489 阅读 · 0 评论 -
mysql- 修改字段
mysql- 修改字段https://www.cnblogs.com/huangxm/p/5736807.html 修改字段属性:-- 修改字段属性-- ALTER TABLE tb_name MODIFY 字段名称 字段类型 [完整性约束条件]-- 将email字段 VARCHAR(50)修改成VARCHAR(200)-- 注意,修改时如果不带完整性约束条件,原有的约...转载 2019-02-25 09:54:53 · 213 阅读 · 0 评论 -
MySQL教程之concat以及group_concat的用法
https://baijiahao.baidu.com/s?id=1595349117525189591&wfr=spider&for=pc请看原文如上.下面几个摘抄如下:一、concat()函数1、功能:将多个字符串连接成一个字符串。2、语法:concat(str1, str2,...)返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为n...转载 2019-02-21 15:43:45 · 227 阅读 · 0 评论 -
mysql 列名中 包含斜杠或者空格的处理方式
mysql 列名中 包含斜杠或者空格的处理方式今天客户那边遇到了一个比较奇葩的问题跑来问我,这个问题比较冷门,所以特别记录下。问题描述数据库的字段存在斜杠或者空格的时候,怎么用sql进行insert或者select操作。问题解答对于这种特殊字符,我们一般想到的是用转义符进行处理,所以试了下"/"、引号、单引号等常见的转义符,发现依然语法错误,又查了下mysql的官方说明:...转载 2019-01-16 10:43:42 · 2608 阅读 · 0 评论 -
MySQL 查看表结构简单命令
MySQL 查看表结构简单命令 点击题目看原文有图片一、简单描述表结构,字段类型desc tabl_name;显示表结构,字段类型,主键,是否为空等属性,但不显示外键。例如:desc table_name二、查询表中列的注释信息select * from information_schema.columnswhere table_schema = 'db' #表所在数据库...转载 2018-12-25 13:42:48 · 468 阅读 · 0 评论 -
Mysql中的排序规则utf8_unicode_ci、utf8_general_ci的区别
Mysql中的排序规则utf8_unicode_ci、utf8_general_ci的区别utf8_unicode_ci和utf8_general_ci对中、英文来说没有实质的差别。utf8_general_ci 校对速度快,但准确度稍差。utf8_unicode_ci 准确度高,但校对速度稍慢。如果你的应用有德语、法语或者俄语,请一定使用utf8_unicode_ci。一般用utf8...转载 2018-12-26 14:02:37 · 475 阅读 · 0 评论 -
CentOS6.5安装与配置Mysql数据库
CentOS6.5安装与配置Mysql数据库http://www.centoscn.com/mysql/2014/1211/4290.html修改/etc/my.cnf在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重启MySQL服务。转载 2017-07-28 12:09:43 · 227 阅读 · 0 评论