This content does not involve the installation of mysql, but only provides the corresponding common instructions. I hope it will be helpful to you.
Distinguish name and xxx based on your own learning progress. I won’t go into details here.
create database `name`; --创建数据库
show databases; --显示资料库
drop database `name`; --删除资料库
use name; --进入数据库
{资料形态
int 整形
varchar(n) 字符
decimal(m,n) 小数
blob 影片档案
date 日期yy mm dd
timestamp 记录时间 yy mm dd hms
}
create table `name`{
id int primary key, ###可以加入限制内容 not null--不能为空 unique--不为重复的值 default--预设值 auto_increment--自动预设值加一
name varchar(10),
major varchar(10)
} ---创建表格
describe `name`; --显示表格
drop `name`; --删除表格
alter table `name` add `属性` int;--添加属性
alter table `name` drop column `属性`;--删除属性
###添加资料
insert into `name` values();
insert into `name` (xxx,xxx,xxx) values();
###列出所有资料
select * from `name`;
###更新表格内容
update `name`
set `major` = '替换'
where 'major' = '英语'
###union合并表格(类型数量需要保持一致)
select xxx from xxxx
union
select xxx from xxxx
##表格合并
select xxx from name
join xxx
on xxx = xxx
##还涉及left join 和 right join
##子查询
select xxx from xxxx
where xxx = (
select xxx from xxx
where xxx = xxx);