当前位置:网站首页>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;
边栏推荐
- Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
- [recommended collection] MySQL 30000 word essence summary index (II) [easy to understand]
- Kotlin属性与字段
- 23.8 using the applicationrunner or commandlinerunner to implement applicationrunner and commandlinerunner
- 海内外媒体宣发自媒体发稿要严格把握内容关
- Oracle 19C OCP 1z0-082 certification examination question bank (36-41)
- What are the differences in the performance of different usages such as count (*), count (primary key ID), count (field) and count (1)? That's more efficient
- Analysis on the query method and efficiency of Oracle about date type
- Xshell batch send command to multiple sessions
- Fluent custom popupmenubutton
猜你喜欢

Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式

My meeting of OA project (query)

OA项目之我的会议(查询)

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

Winter vacation homework & Stamp cutting

Mysql/mariadb (Galera multi master mode) cluster construction

6、 Pinda general permission system__ pd-tools-log

正则表达式:判断是否符合USD格式
![[untitled]](/img/89/c3ab79eb325f0136114a568745924b.png)
[untitled]

The lessons of 2000. Web3 = the third industrial revolution?
随机推荐
[search topics] flood coverage of search questions after reading the inevitable meeting
Flutter upgrade 2.10
pl/sql之集合-2
基于C语言的内存管理-动态分区分配方式模拟
C#入门系列(三十一) -- 运算符重载
The lessons of 2000. Web3 = the third industrial revolution?
Replication of SQL injection vulnerability in the foreground of Pan micro e-cology8
Media at home and abroad publicize that we should strictly grasp the content
Ueditot_ JSP SSRF vulnerability recurrence
利用模m的原根存在性判断以及求解
[recommended collection] MySQL 30000 word essence summary index (II) [easy to understand]
Mysql/mariadb (Galera multi master mode) cluster construction
When developing flutter, idea_ ID cannot solve the problem
12306 ticket system crawling - 1. Saving and reading of city code data
Pxe原理和概念
P1825 [USACO11OPEN]Corn Maze S
Espressif 玩转 编译环境
Leetcode and query question summary
Spark scheduling analysis
Flutter WebView three fingers rush or freeze the screen