当前位置:网站首页>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);
边栏推荐
- Sqoop command
- [105] Baidu brain map - Online mind mapping tool
- Utilisation simple de devtools
- Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
- 有个疑问 flink sql cdc 的话可以设置并行度么, 并行度大于1会有顺序问题吧?
- Daily question 2 12
- Asp+access campus network goods trading platform
- Talk about the SQL server version of DTM sub transaction barrier function
- Kbp206-asemi rectifier bridge kbp206
- LeetCode146. LRU cache
猜你喜欢
Huawei MPLS experiment
[200 opencv routines] 99 Modified alpha mean filter
Tiny series rendering tutorial
el-select,el-option下拉选择框
Simple use of devtools
College Students' innovation project management system
New interesting test applet source code_ Test available
Leetcode42. connect rainwater
Why are there fewer and fewer good products produced by big Internet companies such as Tencent and Alibaba?
Azkaban概述
随机推荐
Returns the lowest common ancestor of two nodes in a binary tree
Sqoop安装
C file in keil cannot be compiled
Moco V2 literature research [self supervised learning]
Apache build web host
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
单项框 复选框
端口,域名,协议。
D3js notes
ICSI213/IECE213 Data Structures
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
ELK日志分析系统
打破信息茧房-我主动获取信息的方法 -#3
Kuboard
Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
Port, domain name, protocol.
Accuracy problem and solution of BigDecimal
1. Five layer network model
LeetCode --- 1071. Great common divisor of strings problem solving Report
TCP security of network security foundation