随笔分类 - MySQL
摘要:由于web用的是mvc,数据库用的是mysql。为了方便开发,在windows7下面也安装了个mysql,今天在创建表的时候,遇到了个棘手的问题。所有的表名都转成了小写,这不是我要的,作为处女座,是不能容忍这样的事情存在的。经过一番折腾后,终于解决了,方法如下。 第一步:先在navicat的tool
阅读全文
摘要:问:MySQL如何给字段添加注释? 答:给MySQL字段添加注释有两种方式 ① 创建表的时候添加 create table student( s_no int not null comment '学号', s_name varchar(100) comment '姓名' ) comment = '学
阅读全文
摘要:方法一 使用 not in ,容易理解,效率低 ~执行时间为:1.395秒~ select distinct A.ID from A where A.ID not in (select ID from B) 方法二 使用 left join...on... , "B.ID isnull" 表示左连接
阅读全文
摘要:参考:https://blog.csdn.net/u012620150/article/details/81945004 mysql 驱动对应 mysql版本
阅读全文
摘要:创建一张表名为order的订单表 查询表数据的时候 总是报java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL s
阅读全文
摘要:mysql 日期 DATE_FORMAT(date,format) 根据format字符串格式化date值。下列修饰符可以被用在format字符串中: %M 月名字(January……December) %W 星期名字(Sunday……Saturday) %D 有英语前缀的月份的日期(1st, 2n
阅读全文
摘要:项目GitHub: https://github.com/uiwjs/province-city-china 另外地区5级:https://gitee.com/ruina2019/china_area?tdsourcetag=s_pcqq_aiomsg 国家统计局:http://www.stats.
阅读全文
摘要:1 SELECT CONCAT( 'drop table ', table_name, ';' ) FROM information_schema.tablesWHERE table_name LIKE 'tb_task_data_%'; 这样得到删除表的sql语句 得到sql后执行即可
阅读全文
摘要:参考:https://www.cnblogs.com/melody210218/p/7120559.html
阅读全文
摘要:mysql的if函数,例如:IF(expr1,expr2,expr3) 说明:如果 expr1是TRUE,则IF()的返回值为expr2; 否则返回值则为expr3实例场景:如果video_id为null,则直接返回空字符,避免不必要的查询影响效率:(SELECT if(isnull(video_i
阅读全文
摘要:参考一 :http://www.cnblogs.com/wupeiqi/articles/5713315.html 参考二:http://www.cnblogs.com/wupeiqi/articles/5713323.html
阅读全文
摘要:update 更新表 set 字段 = (select 参考数据 from 参考表 where 参考表.id = 更新表.id); update table_2 m set m.column = (select column from table_1 mp where mp.id= m.id); 例
阅读全文
摘要:web应用中连接mysql数据库时控制台会出现这样的提示: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.2
阅读全文