当前位置:网站首页>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;
边栏推荐
- Recurrence of SQL injection vulnerability in the foreground of a 60 terminal security management system
- Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
- OA项目之我的会议(查询)
- Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
- TypeScript版Snowflake主键生成器
- Mysql/mariadb (Galera multi master mode) cluster construction
- Please tell me if there is any way to increase the write out rate when the Flink SQL client is in the sink table. When synchronizing through sink table
- 内存管理-动态分区分配方式模拟
- Huffman transformation software based on C language
- Foundry教程:使用多种方式编写可升级的智能合约(上)
猜你喜欢
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
Study notes of automatic control principle -- dynamic model of feedback control system
基于C语言设计的换乘指南打印系统
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
内存管理-动态分区分配方式模拟
pl/sql之集合
Kept dual machine hot standby
node-v下载与应用、ES6模块导入与导出
合工大苍穹战队视觉组培训Day6——传统视觉,图像处理
tcp 解决short write问题
随机推荐
Espressif 玩转 编译环境
有限元学习知识点备案
Ansible important components (playbook)
Xtrabackup appears' flush no '_ WRITE_ TO_ BINLOG TABLES‘: 1205 (HY000) Lock wait timeout exceeded;
[freeswitch development practice] user defined module creation and use
Ueditot_ JSP SSRF vulnerability recurrence
Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
Oracle 19C OCP 1z0-082 certification examination question bank (24-29)
Spark scheduling analysis
[database] gbase 8A MPP cluster v95 installation and uninstall
【数据库 】GBase 8a MPP Cluster V95 安装和卸载
Recurrence of SQL injection vulnerability in the foreground of a 60 terminal security management system
Flutter WebView jitter
What are the contents of Oracle OCP and MySQL OCP certification exams?
Registration of finite element learning knowledge points
Foundry教程:使用多种方式编写可升级的智能合约(上)
The lessons of 2000. Web3 = the third industrial revolution?
【FreeSwitch开发实践】自定义模块创建与使用
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
Oracle 19C OCP 1z0-082 certification examination question bank (30-35)