当前位置:网站首页>day06 作业---技能题7
day06 作业---技能题7
2022-07-26 08:41:00 【宁氓】
1.创建db_test数据库
create database db_test character set utf8;
2.创建yuangong表
create table yuangong(
empno int not null primary key,
ename varchar(50),
job varchar(50),
mgr int,
hiredate date,
sal decimal(7,2),
COMM decimal(7,2),
deptno int
)
desc yuangong;
3.向yuangong表中添加记录
insert into yuangong 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 student;
(2)修改表名为”emp”
alter table yuangong rename emp;
(3)修改ename字段的类型为varchar(40)
alter table emp MODIFY COLUMN ename varchar(40);
desc emp;
(4)删除表中empno是1014并且ename是黄盖的员工信息
delete from emp where empno=1014 and ename='黄盖';
select * from emp;
(5)查询表中empno字段的值是1007,1009或1011员工的所有记录
select * from emp where empno in(1007,1009,1011);
(6)查询表中所有job字段是文员并且姓名是张三的员工的所有信息
select * from emp where job='文员' and ename='张三';
(7)查询表中在2001年以后入职的员工信息
select * from emp where hiredate >'2001-12-31';
边栏推荐
- Huffman transformation software based on C language
- Kotlin function
- Cve-2021-21975 VMware SSRF vulnerability recurrence
- [search topics] flood coverage of search questions after reading the inevitable meeting
- Use index to optimize SQL query "suggestions collection"
- [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
- 解决C#跨线程调用窗体控件的问题
- Oracle 19C OCP 1z0-083 question bank (7-12)
- Redis进阶
- TypeScript版加密工具PasswordEncoder
猜你喜欢
利用模m的原根存在性判断以及求解
node-v下载与应用、ES6模块导入与导出
Flitter imitates wechat long press pop-up copy recall paste collection and other custom customization
uni-app 简易商城制作
SSH,NFS,FTP
IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
Kotlin data type
正则表达式:判断是否符合USD格式
OA项目之我的会议(查询)
Mycat2 sub database and sub table
随机推荐
解决C#跨线程调用窗体控件的问题
P3743 Kotori's equipment
基于C语言的内存管理-动态分区分配方式模拟
Mycat2 deploy master-slave MariaDB
C Entry series (31) -- operator overloading
Oracle 19C OCP 1z0-082 certification examination question bank (24-29)
Flutter text is left aligned with no blank space in the middle
After MySQL 8 OCP (1z0-908), hand in your homework
23.2 customizing the banner control display hidden banner modify banner
Arbitrum launched the anytrust chain to meet the diverse needs of ecological projects
[freeswitch development practice] user defined module creation and use
[suggestions collection] summary of MySQL 30000 word essence - locking mechanism and performance tuning (IV) [suggestions collection]
Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
Automation and disconnection monitoring of video addition
Oracle 19C OCP 1z0-082 certification examination question bank (42-50)
MySQL 8.0 OCP (1z0-908) has a Chinese exam
My meeting of OA project (meeting seating & submission for approval)
Mysql/mariadb (Galera multi master mode) cluster construction
P1825 [USACO11OPEN]Corn Maze S
Redis进阶