mysql 学习

视频链接

解决冲突 使用反引号对键进行标识

键值对 键`` 值''

mysql 能存储的数据类型

INT 整型
DECIMAL 浮点型
VARCHAR(params) 字符型
BLOB 二进制
DATE 日期
TIMESTAMP 时间戳

限制,对键的一些修饰

UNIQUE 唯一
DEFAULT 默认
AUTO_INCREMENT 自增序号
private 私有 ID 效果等价于 not null+unique,即非空且唯一

聚合函数 sum count avg

查询使用 select count(键) from 表名

字源 %多个,_ 一个 配合 like 使用

查询使用 select 键 from 表名 where 键 like ’___12%’

join 连接

查询使用 将多个表相同值连接起来 select 键 from 表 a join 表 b on 表 a.键=表 b.键

联级 union 属性类别需一样

联合查询 select 键 from 表 a union select 键 from 表 b;

子查询

多个 in() 单个结果 =()

增加

insert int 表名 values(值)
create table 表名
create database 数据库名
外链
FOREIGN KEY (emp_id) REFERENCES employee(emp_id) ON DELETE CASCADE,

删除

drop database 数据库名
drop table 表名
delete from 表名 where 条件

更新

update 表名 set 键=值 where 条件
insert inte 表名 values(值)

查询

select 键 from 表 where 条件
———————条件需查询:where 键 in(查询语句)

posted @ 2022-12-07 16:28  悠悠江水  阅读(31)  评论(0)    收藏  举报