mysql中判断字段为null或者不为null 在mysql中,查询某字段为空时,切记不可用 = null, 而是 is null,不为空则是 is not null select nulcolumn from table; if nuncolumn is null then select 1; else select 2; end if; 执行存储过程 调用过程:call sp_add (1,2,@a);select @a;…
解读show slave status 命令判断MySQL复制同步状态 1. show slave status命令可以显示主从同步的状态 MySQL> show slave status \G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: rep…
使用存储过程可以保证数据库升级脚本可以重复执行而不会报错. CREATE TABLE `tb_user` ( `id` ) NOT NULL COMMENT '非自增id', `account` ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, `account_pinyin` ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'account的拼音,用于accoun…
MySQL 数据库常用命令 1.MySQL常用命令 create database name; 创建数据库 use databasename; 选择数据库 drop database name 直接删除数据库,不提醒 show tables; 显示表 describe tablename; 表的详细描述 select 中加上distinct去除重复字段 mysqladmin drop databasename 删除数据库前,有提示. 显示当前mysql版本和当前日期 select version…