当前位置:网站首页>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);边栏推荐
- Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
- TCP security of network security foundation
- Delphi read / write JSON format
- Multi person online anonymous chat room / private chat room source code / support the creation of multiple chat rooms at the same time
- Sqoop command
- Is there any way to change the height of the uinavigationbar in the storyboard without using the UINavigationController?
- Avoid material "minefields"! Play with super high conversion rate
- Apache build web host
- [200 opencv routines] 99 Modified alpha mean filter
- Qrcode: generate QR code from text
猜你喜欢

Pdf things

C file in keil cannot be compiled

Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?

Machine learning experiment report 1 - linear model, decision tree, neural network part

Simple use of devtools

Avoid material "minefields"! Play with super high conversion rate

51 independent key basic experiment

Sqoop command

The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety

Multi person online anonymous chat room / private chat room source code / support the creation of multiple chat rooms at the same time
随机推荐
Sqoop command
C file in keil cannot be compiled
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
El select, El option drop-down selection box
1.五层网络模型
this+闭包+作用域 面试题
Sqoop installation
Devtools的简单使用
Tiny series rendering tutorial
Design of KTV intelligent dimming system based on MCU
Kuboard
Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
D3js notes
1. Five layer network model
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?
Share the newly released web application development framework based on blazor Technology
[Yu Yue education] National Open University autumn 2018 8109-22t (1) monetary and banking reference questions
Utilisation simple de devtools
ICSI213/IECE213 Data Structures
Master Fur