随笔分类 -  SQL

摘要:第一步: 进入File -> Setting -> plugins -> Manage Plugin Repositoies 第二步: 增加 https://plugins.zhile.io 保存 第三步: 进入File -> Setting -> plugins,搜索Eval Reset 并进行安 阅读全文
posted @ 2022-09-29 10:40 linma 阅读(1122) 评论(0) 推荐(0)
摘要:1.python复制表 复制表语句: create table newtable like oldtable; insert into newtable select * from oldtable;​ 注:newtable:要复制的新表 oldtable:数据库中存在的表 python代码: im 阅读全文
posted @ 2021-07-29 16:18 linma 阅读(121) 评论(0) 推荐(0)
摘要:1.将切片时间-1天 update tt_ed_ares_stowage_aging_ratio set slice_tm = DATE_ADD(slice_tm,INTERVAL-1 DAY) ; 2.将切片时间+1天 update tt_ed_ares_stowage_aging_ratio s 阅读全文
posted @ 2021-04-16 09:34 linma 阅读(1006) 评论(0) 推荐(0)
摘要:SQL JOIN 子句用于把来自两个或多个表的行结合起来,基于这些表之间的共同字段。 常用语法: select column_name(s) from table 1 JOIN table 2 ON table 1.column_name=table 2.column_name 业务相关1: 业务相 阅读全文
posted @ 2021-01-04 17:10 linma 阅读(216) 评论(0) 推荐(0)
摘要:求和: select sum(A) from table1 where id = '1'; select sum(B) from table2 where id = '1'; 若求和值为Null,需要转换,否组会报错 通过IFNULL转换,转换格式:IFNULL(字段,0) 调整后如下: selec 阅读全文
posted @ 2020-12-30 17:46 linma 阅读(160) 评论(0) 推荐(0)
摘要:表约束 唯一约束:unique,声明该字段是唯一的 非空约束:not null,声明该字段非空 主键约束:primary key,声明某一列为主键,具有唯一性、非空性和被引用的特性 主键的自增长 auto_increment create table stu( id int primary key 阅读全文
posted @ 2020-07-31 17:09 linma 阅读(291) 评论(0) 推荐(0)
摘要:查询 select * from 表名称; select 字段1,字段2 from 表名称; distinct 去掉重复的关键字 别名 select t.字段1 from 表名称 t; where 语句 举例: select name, job from emp; select distinct s 阅读全文
posted @ 2020-07-23 20:32 linma 阅读(216) 评论(0) 推荐(0)
摘要:SQL数据库操作 创建数据库 create database 数据库名称; create database 数据库名称 character set ‘utf8’; 查看数据库 show databases; show create database 数据库名称; 查询数据库创建时的信息 切换数据库 阅读全文
posted @ 2020-07-23 20:30 linma 阅读(120) 评论(0) 推荐(0)
摘要:下载免安装版的zip文件 mysql-8.0.19-winx64.zip 1.解压mysql-8.0.19-winx64.zip后,进入bin目录,cmd打开黑框 2.输入安装命令 mysqld –install 3.通过命令mysqld –initialize –console初始化mysql,此 阅读全文
posted @ 2020-07-22 15:42 linma 阅读(170) 评论(0) 推荐(0)