mysql 连接查询
数据准备 学生表(字段:主键ID、学生编号、科目编号、学生姓名) create table if not exists `students_test` ( `id` int(11) not null auto_increment, `stuid` int(11) not null, `subid` int(11) default null, `stuname` varchar(50) not nu…
数据准备 学生表(字段:主键ID、学生编号、科目编号、学生姓名) create table if not exists `students_test` ( `id` int(11) not null auto_increment, `stuid` int(11) not null, `subid` int(11) default null, `stuname` varchar(50) not nu…
1、统计表中每个部门的男生,女生各多少人 select deptid as 部门id, sum(case sex when '男' then 1 else 0 end) as 男生人数, sum(case sex when '女' then 1 else 0 end) as 女生人数 from hrmresource GROUP BY deptid 2、查询出人数最多的部门id select de…
链接在此 版权声明:本文为qq_45292079原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/qq_45292079/article/details/105783797
1、创建名为(db_mingzhu)的数据库并进行查看 2、切换到(db_mingzhu)数据库, 3、在(db_mingzhu)数据库中创建表(由于表达数据类型有错误,第二张截图是修改author列类型) <1>t_sanguo <2>t_shuihuo <3>t_honglou <4>t_xiyou 4、插入数据(新创建一个表) 版权声明:本文为…
步骤一:下载rpm安装包 文章已迁移: 详细内容点击这里 wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm 步骤二:安装rpm包 yum install mysql80-community-release-el8-1.noarch.rpm 步骤三:禁用CentOS8自带mysql模块 步骤四:安装My…
背景:在某次创建活动时,设置活动的有效期(数据库表的字段是 TIMESTAMP类型 ),代码中设置过期时间为当前时间的之后30年。存储时报错。 ###Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value : '2048-04-09 20:03:15.486' for column '…
示例SQL代码如下: select username from user where not(username regexp "[\u0391-\uFFE5]"); 这个正则表达式就能判断出来了。
mysql部署 在 k8s 实战篇 - mysql部署 - 1 章节中,已经部署好了mysql。部署好之后需要使用到mysql的存储及查询数据等功能。但是mysql不可避免的会出现宕机或者误删除的情况。数据能持久保存下来的话,在下次mysql重启或者是重新部署的时候,就不需要在导入数据。这一章主要讲解如何存储数据到宿主机硬盘,在重新部署的时候加载宿主机硬盘数据。 1、准备初始化脚本信息 创建表空间…
SELECT list is not inGROUP BY clause and contains nonaggregated column MySQL严格模式主要用以下场景 不支持对not null字段插入null值 不支持对自增长字段插入”值 不支持text字段有默认值 我们用不到时可以关闭它,在Laravel中可以编辑database.php,关闭严格模式,不使用框架时,可以编辑my.ini…
背景: springboot项目配置的druid连接池。今天启动项目时突然报com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link,拒绝连接。然后前端的反映就是请求一直pending。 排查原因: mysql用的5.6,默认的wait_time是8小时,8小时后连接自动断开,但是druid连接池中的连…