diff --git "a/19\345\224\220\345\233\275\344\272\256/20230315\344\275\234\344\270\232.md" "b/19\345\224\220\345\233\275\344\272\256/20230315\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..b8c3f23b563cf826548a101fc417327eba398ab5 --- /dev/null +++ "b/19\345\224\220\345\233\275\344\272\256/20230315\344\275\234\344\270\232.md" @@ -0,0 +1,107 @@ + + +```mysql +create database dsb charset utf8; +use dsb; + + + +create table roleinfo( +id int primary key, +name varchar(20), +location varchar(20), +wqtype varchar(20), +eintroduce varchar(20), +qintroduce varchar(20), +address varchar(20) +); + + +create table syexam( +id int, +name varchar(20), +Holdratio varchar(20), +Useratio varchar(20), +ZDratio varchar(20) +); + + +alter table syexam add foreign key (id) references roleinfo(id); + + + +insert into roleinfo values +(1,'钟离','辅助','长枪','开盾减抗','输出控制','璃月'), +(2,'胡桃','主c','长枪','为武器火附魔提升攻击力','造成大范围火伤','璃月'), +(3,'神里凌华','主c','单手剑','造成小范围冰伤并产生能量球','生成持续7秒冰风暴','稻妻'), +(4,'雷神','辅助','长枪','造成持续30秒的跟随伤害','兄口拔刀斩断一切并提供全队充能','稻妻'), +(5,'夜兰','副c','弓','长达3秒奔跑产生能量球','造成持续15秒的跟随伤害并增伤','璃月'), +(6,'温迪','辅助','弓','起飞并产生能量球','发射风龙卷聚怪并造成伤害','蒙德'), +(7,'纳西妲','副c','法器','扫描后有条件提供30秒的跟随伤害','去她家做客提升e技能伤害','枫丹'), +(8,'心海','辅助','法器','放帮帮进行回血','重置帮忙提升平a伤害','稻妻'); + + +insert into syexam values +(1,'钟离','87.8%','81.1%','+6.1%'), +(2,'胡桃','53.8%','38.4%','+9.9%'), +(3,'神里凌华','56.6%','18.2%','-5.8%'), +(4,'雷神','85.7%','70.3%','-3.9%'), +(5,'夜兰','79.9%','69.8%','+6.9%'), +(6,'温迪','55.6%','8.1%','-1.5%'), +(7,'纳西妲','81.3%','85.6%','-2.7%'), +(8,'心海','45.4%','56.5%','-6,5%'); + + +select * from roleinfo; +select * from syexam; + + +-- +-- 1. 在‘’角色信息‘’表格中添加一个新的角色序号‘’9‘’ 角色名‘丘丘人’主要定位‘前台主c’,武器类型‘武器大师‘, e技能介绍‘射弓箭’,q技能介绍‘火把冲锋’,角色所属地‘坎瑞亚’ +insert into roleinfo values (9,'丘丘人','前台主c','武器大师','射弓箭','火把冲锋','坎瑞亚'); +-- 2 将角色纳西达的角色所属地改为‘须弥 +update roleinfo set address = '须弥' where name = '纳西妲'; +-- 3 查询所有角色信息表(roleinfo)中所有列信息,给每列取上中文名称 +select id 序号,name 角色名,location 主要定位,wqtype 武器类型,eintroduce E技能介绍,qintroduce Q技能介绍,address 角色归属地 from roleinfo; +-- 4 查询使用长枪为武器的角色 +select * from roleinfo where wqtype = '长枪'; +-- 5 查询主要定位为辅助的角色 +select * from roleinfo where location = '辅助'; +-- 6 查询持有率最高的角色 +select * from syexam where Holdratio =(select max(Holdratio) from syexam); +-- 7 查询3.4深渊使用率排行前三的角色 +select * from syexam order by Useratio desc; +-- 8 找出角色持有率大于50%的所有角色中使用率不到40%的角色信息 +select r.* from syexam s,roleinfo r where s.id=r.id and Holdratio > '50%' and Useratio < '40%'; +-- 9 查询3.4使用率在50%及以上的角色 +select * from syexam where Useratio > '50%'; +-- 10 查询3.4使用率在50%及以上的角色和角色主要定位 +select r.name 角色,r.location 主要定位 from syexam s,roleinfo r where s.id = r.id and Useratio > '50%'; +-- 11 查询辅助角色在3.4深渊的使用率 +select r.name,r.location,s.Useratio from syexam s,roleinfo r where s.id = r.id and location = '辅助'; +-- 12 查询上一期钟离使用率 +select name,(Useratio-ZDratio) from syexam where name = '钟离'; +-- 13 按角色的持有率降序和使用率升序来显示所有(syexam)\ +select * from syexam order by Holdratio desc , Useratio asc; +-- 14 查询不同所属地的所有角色平均持有率 +select r.address, avg(Useratio) from roleinfo r,syexam s where r.id = s.id group by address; +-- 15 查询使用率比夜兰高的角色e技能介绍和q技能介绍 +select s.Useratio,r.name,r.eintroduce,r.qintroduce from roleinfo r,syexam s where r.id = s.id and Useratio > (select Useratio from syexam where name = '夜兰'); +-- 16 查询3.4涨幅和跌幅最高的角色 + + +-- + + + + + + + + +``` + + + + +