当前位置:网站首页>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;
边栏推荐
- Automation and disconnection monitoring of video addition
- 合工大苍穹战队视觉组培训Day6——传统视觉,图像处理
- pl/sql之动态sql与异常
- 利用模m的原根存在性判断以及求解
- Fluent custom popupmenubutton
- sklearn 机器学习基础(线性回归、欠拟合、过拟合、岭回归、模型加载保存)
- C#入门系列(三十一) -- 运算符重载
- File management file system based on C #
- Leetcode and query question summary
- PXE principles and concepts
猜你喜欢

Foundry tutorial: writing scalable smart contracts in various ways (Part 1)

基于C语言的哈夫曼转化软件

Pxe原理和概念

为什么要在时钟输出上预留电容的工位?

Transfer guide printing system based on C language design

Using the primitive root of module m to judge and solve

正则表达式:判断是否符合USD格式

Web3 Games: current situation and future

Mysql/mariadb (Galera multi master mode) cluster construction
![[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
随机推荐
Redis advanced
Number of briquettes & Birthday Candles & building blocks
Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
[search topics] flood coverage of search questions after reading the inevitable meeting
SSH,NFS,FTP
Flutter WebView jitter
1、 Redis data structure
Flutter text is left aligned with no blank space in the middle
Oracle 19C OCP 1z0-082 certification examination question bank (24-29)
idea快捷键 alt实现整列操作
Ueditot_ JSP SSRF vulnerability recurrence
SSH,NFS,FTP
P3743 kotori的设备
[suggestions collection] summary of MySQL 30000 word essence - locking mechanism and performance tuning (IV) [suggestions collection]
Cve-2021-3156 duplicate of sudo heap overflow privilege raising vulnerability
node-v下载与应用、ES6模块导入与导出
Foundry教程:使用多种方式编写可升级的智能合约(上)
Grid segmentation
Oracle 19C OCP 1z0-083 question bank (1-6)
The full name of flitter IDFA is identity for advertisers, that is, advertising identifiers. It is used to mark users. At present, it is most widely used for advertising, personalized recommendation,