02 2023 档案
摘要:DML数据增删改 DDL表和库增删改:执行结果可以为0,不能用影响行数判断
阅读全文
摘要:连接查询: 内连接:AB交集 隐式内连接 select t1.name, t1.age, t2.dname from emp t1, dept t2 where t1.dep_id=t2.did; --起别名简化书写 显式内连接 select * from emp join dept on emp.
阅读全文
摘要:一对多: 在多的一方建立外键关联一的一方 多对多:(订单/商品) 建立第三张中间表,中间表至少包含两个外键,分别关联两个主键 中间表可以计数 一对一:(一张表拆成用户表和用户详情表) 在任意一方加入外键,关联另一方主键,设此外键unique
阅读全文
摘要:drop table if exists emp; -- 建表emp create table emp ( id int primary key auto_increament; -- 主键且自增.数字且唯一 ename varchar(50) not null unique; -- 非空,唯一 j
阅读全文
摘要:聚合函数 查班里一共多少学生: select count(id) from stu; -- count()统计的列名不能为null select count(*) from stu; -- 推荐写* 查班里数学最高/低分/平均分: select min(math) from stu; -- 聚合函数
阅读全文
摘要:模糊查询 查姓马: select * from stu where name like '马%'; 查第二个字是花: select * from stu where name like '_花%'; -- 下划线占第一个位置 查名字里包含德:: select * from stu where nam
阅读全文
摘要:基础查询: select name,age from stu; -- 查两列 select * from stu; -- 查全部,不推荐 select distinct address from stu; --查一列去除重复数据 select name,math as 数学成绩,english as
阅读全文
摘要:给指定列添加数据: insert into stu(id,name) values(1,'张三'); insert into stu values(1,'张三'); -- 所有列时,列表可省略(不建议) insert into stu values(1,'张三'),(2,'李四'),(3,'王五')
阅读全文
摘要:查询当前数据库下所有表名称: show tables; 查询表结构: desc user; 创建表: create table tb_user( id int, age int, score double(5,2), -- 小数点后两位,5-2=3,三位数100,0~100.00 birthday
阅读全文
摘要:查询数据库: show databases; 创建数据库: create database db1; create database if not exist db1; 删除数据库: drop database db1; drop database if exists db1; 查看数据库: sel
阅读全文
摘要:https://blog.csdn.net/qq_44790505/article/details/123844243
阅读全文
摘要:https://zhuanlan.zhihu.com/p/403200350
阅读全文
摘要:https://blog.csdn.net/joker_Ling/article/details/114277469
阅读全文
摘要:https://www.cnblogs.com/cynthia-wuqian/p/14972178.html
阅读全文
摘要:版本IntelliJ IDEA 2020.1.2 x64 解决方法https://blog.csdn.net/weixin_47320872/article/details/107565091
阅读全文