今日学习目标
- 熟悉关键字用法,掌握多表查询思路
文章目录
学习内容
- 查询关键字
- 多表查询思路
- 可视化软件navicat
一、查询关键字
关键字功能讲解依靠例题讲解,争取做到通俗易懂。
例题数据
create table emp(
id int primary key auto_increment,
name varchar(20) not null,
sex enum('male','female') not null default 'male', #大部分是男的
age int(3) unsigned not null default 28,
hire_date date not null,
post varchar(50),
post_comment varchar(100),
salary double(15,2),
office int, #一个部门一个屋子
depart_id int
);
create table emp(
id int primary key auto_increment,
name varchar(20) not null,
sex enum('male','female') not null default 'male', #大部分是男的
age int(3) unsigned not null default 28,
hire_date date not null,
post varchar(50),
post_comment varchar(100),
salary double(15,2),
office int, #一个部门一个屋子
depart_id int
);
#插入记录
#三个部门:教学,销售,运营
insert into emp(name,sex,age,hire_date,post,salary,office,depart_id) values
('jason','male',18,'20170301','张江第一帅形象代言',7300.33,401,1), #以下是教学部
('tom','male',78,'20150302','teacher',1000000.31,401,1),
('kevin','male',81,'20130305','teacher',8300,401,1),
('tony','male',73,'20140701','teacher',3500,401,1),
('owen','male',28,'20121101','teacher',2100,401,1),
('jack','female',18,'20110211','teacher',9000,401,1),
('jenny','male',18,'19000301','

本文主要介绍了Python开发者在MySQL数据库操作中应掌握的关键字,包括having、distinct、order by、limit和regexp的用法,并详细阐述了多表查询的思路,如子查询和连表操作,同时提到了使用Navicat进行数据库管理的便利性。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



