07 2021 档案
摘要:order by FIELD(排序列,value1,value2....) desc/asc select * from sy_cd_ms_base_hospital_info order by FIELD(grade,"三甲","三乙","三丙","二甲") asc 图中按照"三甲","三乙","
阅读全文
摘要:select (case when regCapital REGEXP '^¥' then substring(regCapital,2,length(regCapital)-9) when regCapital REGEXP '^[0-9.]*万元$' then substring(regCapi
阅读全文
摘要:查看支持的存储引擎 show engines show variables like '%storage_engine%' innodb是唯一支持外键的引擎,创建外键时加 on delete restrict 表示删除主键时,如果主键被其他外键引用,则不删除, on update cascade 表
阅读全文
摘要:--触发器:在增删改之前或之后,触发执行触发器中定义的sql语句集合,可用于保持数据完整性,日志记录,数据校验等操作, 触发器类型有new:插入或更新后的新数据,old:删改之前的数据创建触发器:create trigger trigger_namebefore/after insert/delet
阅读全文
摘要:第一种写法: ifnull(exper1,exper2)判断exper1是否为空,是则用exper2代替,这种当exper1为空串时还会取exper1 第二种写法: (CASE WHEN contractName='' or contractName is null then projectName
阅读全文
摘要:>= 对应 >= > 对应 > <= 对应 <= < 对应 < 注意有最后的分号
阅读全文
摘要:用法相当于聚合函数,在分组时使用,将同一组的某个字段用concat拼接起来,比如表中有省份和城市字段,页面要二级联动的效果 select provinceName,group_concat(cityName) AS cityName from tablenamewhere provinceName
阅读全文