当前位置:网站首页>MySQL winter vacation self-study 2022 11 (9)
MySQL winter vacation self-study 2022 11 (9)
2022-07-05 03:13:00 【Crane paper thousand】
Code preparation for multi table query exercise
-- establish test1 database
create database test1;
-- Choose to use test1 database
use test1;
-- Create department table
create table dept(
deptno int primary key comment ' Department number ',
dname varchar(14) comment ' Department name ',
loc varchar(13) comment ' Department Address '
);
insert into dept values(10,'accounting','new york'),
(20,'research','dallas'),
(30,'sales','chicago'),
(40,'operations','boston');
-- Create an employee table
create table emp(
empno int primary key comment ' Employee number ',
ename varchar(10) comment ' Employee name ',
job varchar(9) comment ' Staff work ',
mgr int comment ' Employee's direct leader No ',
hiredate date comment ' Entry time ',
sal double comment ' Wages ',
comm double comment ' Bonus ',
deptno int comment ' Corresponding dept Table foreign key '
);
-- Add foreign key relationships between departments and employees
alter table emp add constraint foreign key emp(deptno) references dept (deptno);
-- Create a pay scale
create table salgrade(
grand int comment ' Grade ',
losal double comment ' minimum wage ',
hisal double comment ' Maximum wage '
);
insert into salgrade values (1,700,1200),(2,1201,1400),(3,1401,2000),(4,2001,3000),(5,3001,9999);
insert into emp values
(7369,'smith','clerk' 7902,'1980-12-17',800,null,20),
(7499,'allen','salesman',7698,'1981-02-20',1600,300,30),
(7521,'ward','salesman',7698,'1981-02-22',1250,500,30);
(7566,'JONES','MANAGER',7839,'1981-04-02',2975,NULL,20),
(7654,'MARTIN','SALESMAN',7698,'1981-09-28',1250,1400,30),
(7698,'BLAKE','MANAGER',7839,'1981-05-01',2850,NULL,30),
(7782,'CLARK','MANAGER',7839,'1981-06-09',2450,NULL,10),
(7788,'SCOTT','ANALYST',7566,'1987-04-19',3000,NULL,20),
(7839,'KING','PRESIDENT',NULL,'1981-11-17',5000,NULL,10),
(7844,'TURNER','SALESMAN',7698,'1981-09-08',1500,0,30),
(7876,'ADAMS','CLERK',7788,'1987-05-23',1100,NULL,20),
(7900,'JAMES','CLERK',7698,'1981-12-03',950,NULL,30),
(7902,'FORD','ANALYST',7566,'1981-12-03',3000,NULL,20),
(7934,'MILLER','CLERK',7782,'1982-01-23',1300,NULL,10);
边栏推荐
- SFTP cannot connect to the server # yyds dry goods inventory #
- 2021 Li Hongyi machine learning (3): what if neural network training fails
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- Design of kindergarten real-time monitoring and control system
- 1.五层网络模型
- College Students' innovation project management system
- Sqoop command
- Use UDP to send a JPEG image, and UPD will convert it into the mat format of OpenCV after receiving it
- Une question est de savoir si Flink SQL CDC peut définir le parallélisme. Si le parallélisme est supérieur à 1, il y aura un problème d'ordre?
- 【微服务|SCG】Filters的33种用法
猜你喜欢
Huawei MPLS experiment
Design and implementation of kindergarten management system
1.五层网络模型
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Pdf things
VM in-depth learning (XXV) -class file overview
Linux Installation redis
Ubantu disk expansion (VMware)
51 independent key basic experiment
随机推荐
IPv6 experiment
51 independent key basic experiment
Avoid material "minefields"! Play with super high conversion rate
This + closure + scope interview question
Design and implementation of high availability website architecture
Usage scenarios and solutions of ledger sharing
Elk log analysis system
Azkaban安装部署
Azkaban installation and deployment
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
[deep learning] deep learning reference materials
The database and recharge are gone
Leetcode42. connect rainwater
Port, domain name, protocol.
Machine learning experiment report 1 - linear model, decision tree, neural network part
Azkaban实战
2. Common request methods
College Students' innovation project management system
Why is this an undefined behavior- Why is this an undefined behavior?
8. Commodity management - commodity classification