当前位置:网站首页>day06 作业--技能题2
day06 作业--技能题2
2022-07-26 08:41:00 【宁氓】
1.创建test数据库
create database test character set utf8;2.在test数据库中创建emp表(id设置为主键自增长)
create table emp(
empno int not null primary key auto_increment,
ename varchar(50),
job varchar(50),
mgr int,
hiredate date,
sal decimal(7,2),
COMM decimal(7,2),
deptno int
)
desc emp; 
3.向emp表中添加记录
insert into emp value (1001,'甘宁','文员',1013,'2000-12-17',8000.00,null,20),
(1002,'黛绮丝','销售员',1006,'2001-02-20',16000.00,3000.00,30),
(1003,'殷正天','销售员',1006,'2001-02-22',12500.00,5000.00,30),
(1004,'刘备','经理',1009,'2001-04-02',29750.00,null,20),
(1005,'谢逊','销售员',1006,'2001-09-28',12500.00,14000.00,30),
(1006,'关羽','经理',1009,'2001-05-01',28500.00,null,30),
(1007,'张飞','经理',1009,'2001-09-01',24500.00,null,10),
(1008,'诸葛亮','分析师',1004,'2007-04-19',30000.00,null,20),
(1009,'曾阿牛','董事长',null,'2001-11-17',50000.00,null,10),
(1010,"韦一笑","销售员",1006,"2001-09-08",15000.00,0.00,30),
(1011,"周泰","文员",1008,"2007-05-23",11000.00,null,20),
(1012,"程普","文员",1006,"2001-12-03",9500.00,null,30),
(1013,"庞统","分析师",1004,"2001-12-03",30000.00,null,20),
(1014,"黄盖","文员",1007,"2002-01-23",13000.00,null,10),
(1015,"张三","文员",1007,"2002-01-23",53000.00,null,50)使用sql语句完成以下功能;
(1)查询表中所有内容
select * from emp;
(2)查询表中姓名是张三的所有消息记录
select * from emp where ename='张三';
(3)查询表中姓名是三个字组成的所有员工的ename,job,sal字段的对应信息
select ename,job,sal from emp where ename like '___';

(4)查询表中empno字段从1004至1008所有员工的记录
select * from emp where empno between 1004 and 1008;
(5)查询表中所有job字段是文员并且姓名是黄盖的员工的所有信息
select * from emp where job='文员' and ename='黄盖';
(6)查询表中在2001年以后入职的员工信息
select * from emp where hiredate >='2002-01-01';
(7)查询表中奖金(COMM)是NULL的员工信息
select * from emp where COMM is null;
边栏推荐
- MySQL 8.0 OCP (1z0-908) has a Chinese exam
- Super potential public chain dfinity -- the best time for DFI developers to enter
- Ueditot_ JSP SSRF vulnerability recurrence
- The effective condition of MySQL joint index and the invalid condition of index
- pl/sql之动态sql与异常
- Fluent uses protobuf
- 【FreeSwitch开发实践】自定义模块创建与使用
- tcp 解决short write问题
- My meeting of OA project (query)
- pl/sql之集合
猜你喜欢

Memory management based on C language - Simulation of dynamic partition allocation
![[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls](/img/8b/d5792a00fc5798d3d960f1f1b1088e.png)
[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls
![[encryption weekly] has the encryption market recovered? The cold winter still hasn't thawed out. Take stock of the major events that occurred in the encryption market last week](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[encryption weekly] has the encryption market recovered? The cold winter still hasn't thawed out. Take stock of the major events that occurred in the encryption market last week
![[database] gbase 8A MPP cluster v95 installation and uninstall](/img/56/c0dae30ba608842c1b92e914ef42fe.png)
[database] gbase 8A MPP cluster v95 installation and uninstall

What are the contents of Oracle OCP and MySQL OCP certification exams?

Sub Chocolate & paint area

基于C语言的内存管理-动态分区分配方式模拟

C Entry series (31) -- operator overloading

tcp 解决short write问题

基于Raft共识协议的KV数据库
随机推荐
基于C语言的内存管理-动态分区分配方式模拟
Analysis on the query method and efficiency of Oracle about date type
After MySQL 8 OCP (1z0-908), hand in your homework
Xshell batch send command to multiple sessions
Mycat2 deploy master-slave MariaDB
Pxe原理和概念
Oracle 19C OCP 1z0-082 certification examination question bank (36-41)
Redis advanced
Flutter text is left aligned with no blank space in the middle
基于Raft共识协议的KV数据库
pl/sql之动态sql与异常
KV database based on raft consensus protocol
23.10 Admin features
23.2 customizing the banner control display hidden banner modify banner
OA项目之我的会议(会议排座&送审)
Kept dual machine hot standby
The data read by Flink Oracle CDC is always null. Do you know
Web3 Games: current situation and future
基于C#实现的文件管理文件系统
One click deployment of lamp and LNMP scripts is worth having