- 博客(41)
- 资源 (1)
- 收藏
- 关注
原创 LaTex学习笔记(二):文档的基本结构2【book】,part chapter section subsection toc title
文档的基本结构2【book】,part chapter section subsection toc title
2022-08-01 14:02:16
741
原创 MongoDB中的数据导出为csv文件
1、打开命令行,进入我们所安装的mongodb路径下的bin文件夹2、我们采用bin文件夹下的mongoexport方法进行导出,mongoexport -d myDB -c user -f _id,name,password,adress --csv -o ./user.csv-d 标示 数据库-c 标示 数据表-f 需要提取的field用逗号分隔-o 输出路径打开csv文件如果出现乱码,就用记事本打开,再另存一定要改编码!!!...
2020-06-10 18:47:39
1330
1
原创 添加学生成绩记录
本题目要求编写insert语句, 在sc表中,为学号为S012的学生添加以下学生选课成绩记录。 选修C001课程,成绩为90。 选修C002课程,成绩为空注意:每条inser语句应以";"结束。insert into scvalues('S012','C001',90);insert into sc values('S012','C002',null);就是简单的插入操作,记住固定用法即可insert into table_namevalues*(___)*...
2020-05-26 12:46:24
6347
原创 删除成绩为空的学生选课记录
** 在SC表中删除成绩为NULL的学生选课记录。**这题比较简单,直接代码delete from scwhere grade is null;
2020-05-25 19:24:54
15565
3
原创 修改女生成绩
要求编写UPDATE语句, 把所有低于75分的女生成绩提高5%;涉及到的表:sc、stuUPDATE scSET grade=grade*(1+0.05)WHERE grade<75 and sno in( select sno from stu where sex='0')
2020-05-25 19:21:33
2955
原创 批量插入学生记录
将stu表中的软件工程专业(专业号mno为’02’)的学生记录批量插入到一个学生简表softstu表中。insert into softstu(sno,sname)select sno,snamefrom stu where mno='02';
2020-05-25 19:18:43
2863
原创 查询生产三种不同型号的PC的厂商
涉及到的表:pc、productselect makerfrom ( select maker,model from product where model in ( select model from pc ))as a group by maker having count(maker)=3
2020-05-25 19:14:08
4410
1
原创 查询厂商D生产的PC和便携式电脑的平均价格
设计到的表:product、pc、laptopselect avg(price) as avg_pricefrom ( select model,price from pc union select model,price from laptop)as a where model in ( select model from product where maker='D')
2020-05-25 19:11:38
2191
原创 查询只卖三种不同型号PC的厂商
涉及到的表:这个系列的四个表均涉及到了!!!select makerfrom ( select maker,model from product where model in ( select model from pc )) as agroup by makerhaving count(maker)>=3 and maker not in ( select maker from product wher
2020-05-25 19:08:39
1381
原创 查询至少生产三种不同速度PC的厂商
涉及到的表:product、pcselect maker from( select a.maker,b.speed from product a join pc b on a.model=b.model group by b.speed,a.maker )as a group by maker having count(*)>=3这个涉及到了join on的用法,目前这种方法我还不太熟练...
2020-05-25 19:06:35
2226
原创 查询生产最高速度的计算机(PC或便携式电脑)厂商
涉及到的表:product、pc、laptopselect makerfrom productwhere model in ( select a.model model from( select model,speed from pc union select model,speed from laptop )as a where a.speed=( select m
2020-05-25 19:01:31
2805
原创 查询至少生产两种不同的计算机(PC或便携式电脑)且机器速度至少为133的厂商
涉及到的表:product、pc、laptopselect makerfrom ( select maker,model from product where model in ( select model from pc where speed>=133 ) union select maker,model from product where model in ( s
2020-05-25 18:54:23
1808
原创 查询在具有最小内存容量的所有PC中具有最快处理器的PC制造商
涉及到的表:product(找制造商maker)、pcselect makerfrom product,pc where product.model=pc.model and ram in( select min(ram) from pc )and speed in ( select max(speed) from product,pc where product.model=pc.model and ram in( selec
2020-05-25 18:47:29
981
1
原创 查询具有最低价格的的彩色打印机的制造商
涉及到的表:product、printerselect maker from product,printerwhere product.model=printer.model and color='1' and price in ( select min(price) from product,printer where product.model=printer.model and color='1')解题思路:先将两个表做连接,找出彩色打印机,再查找价格
2020-05-25 18:41:31
5098
2
原创 查询具有最高价格的机器的型号,机器包括PC、Laptop、Printer
本题关键:将三个表进行连接,查询出价格最高的机器的型号解题思路:先将三个表的型号做连接,再将三个表的价格做连接,再利用max函数取出价格最大值,与型号做连接,即找出了价格最高的机器的型号select a.model model from ( select price,model from pc union select price,model from laptop union select price,model fro
2020-05-25 18:34:39
2402
原创 【数据库查询--计算机、电脑系列】-- 查询速度低于任何PC的便携式电脑。
分析:涉及到pc表、laptop表利用到了**<all**的方法上代码:select model from laptopwhere speed < all ( select speed from pc)
2020-04-24 12:12:02
1585
原创 【数据库查询--计算机、电脑系列】--查询价格最高的打印机型号。
分析:涉及到printer这个表注意**>=all 的用法**在查找最大值时很有用上代码:select distinct modelfrom printer where price >= all ( select price from printer)...
2020-04-24 12:09:45
3287
原创 【数据库查询--计算机、电脑系列】--查询拥有相同速度和内存的PC机的成对的型号,输出结果属性名分别为model1,model2。
分析:只涉及到pc表,但涉及到自身连接查询,将自身表变成两个临时表上代码:select a.model as model1,b.model as model2from pc as a,pc as bwhere a.speed=b.speed and a.ram=b.ram and a.model<b.modelorder by model1;a.model<b.model...
2020-04-24 12:05:48
4090
1
原创 【数据库查询--计算机、电脑系列】--查询在两种或两种以上PC机上出现的硬盘容量。
分析:只涉及到了pc表这道题主要注意count的使用表结构见之前的博文上代码:select hdfrom pcgroup by hdhaving count(*)>=2;
2020-04-24 12:01:58
2715
原创 【数据库查询--计算机、电脑系列】--查询所有出售便携式电脑(而不出售PC机)的生产厂商。
分析:涉及到三个表:product、laptop、pc表表结构详见:点这里涉及到嵌套查询、连接查询上代码:select distinct makerfrom product,laptopwhere product.model=laptop.model and maker not in ( select maker from product,pc where pr...
2020-04-24 11:59:53
2787
原创 【数据库查询--计算机、电脑系列】--查询由生产厂商B生产的所有产品的型号(model) 和价格(price)。
分析:这道题将四个表全部涉及到了,所以这时应想到一个方法:union的使用提示:查询按照pc、laptop和printer的顺序进行。上代码:select model,pricefrom ( select model,price from pc union select model,price from laptop union se...
2020-04-24 11:54:32
2097
原创 【数据库查询--计算机、电脑系列】--查询配置了容量至少为1G字节硬盘的便携式电脑的生产厂商及其速度。
分析:涉及到的表:product、laptop表表结构详见点这里话不多说,上代码select maker,speedfrom product,laptopwhere type='便携式电脑' and hd>=1 and product.model=laptop.model;简单的连接查询...
2020-04-24 11:43:06
2450
1
原创 【数据库查询--电影制片系列】--查询比a1更富有的行政长官
分析:涉及到的表为:MovieExec、Studio表利用两个嵌套查询代码如下;select namefrom MovieExecwhere networth>any( select networth from MovieExec where name='a1')and certID in ( select presCertID fro...
2020-04-21 21:21:23
2426
原创 【数据库查询--电影制片系列】--查询比电影M1时间更长的电影。
分析:涉及到的表:Movie表利用自身连接查询:select title,yearfrom Moviewhere length>any ( select length from Movie where title='M1' )>any 即查找所有长度比其长的电影...
2020-04-21 21:19:16
1780
原创 【数据库查询--电影制片系列】--查询在st1公司于2018年制作的电影中出演的影星。
分析;涉及到Movie、StarsIn表表结构详见点这里代码:select distinct starNamefrom StarsInwhere movieTitle in( select title from Movie where studioName='st1' and movieYear in( select year ...
2020-04-21 21:15:51
3600
原创 【数据库查询--电影制片系列】--检索出StarsIn表中在1990年拍摄过电影的所有影星,或者拍摄过电影名中含有3的电影的所有影星。
分析:涉及到StarsIn表原表详见点这里代码如下:select starNamefrom StarsInwhere movieYear='1990' or movieTitle like '3%';这块一个重要的知识点:名字中含有“3” 要用 like '3%'...
2020-04-21 21:02:47
4386
4
原创 【数据库查询--电影制片系列】-- 检索出Studio表中制片公司st1的地址。
分析:涉及到studio表,即制片公司表原表内容详见点这里代码如下:select addressfrom Studiowhere name='st1';简单的查询
2020-04-21 20:58:24
1741
原创 【数据库查询--电影制片系列】--所有涉及到的表
starsIn表:Studio表:MovieStar表:MovieExec表:Studio表:在后续博文中将不再对这些表描述,后续博文直接上代码
2020-04-21 20:55:01
1338
原创 【数据库Mysql查询系列】--检索出sc表中至少选修了’C001’与’C002’课程的学生学号。
涉及到之前博文写到的sc表,自身嵌套查询直接上代码select distinct sno as 学号from sc where cno='C001'and sno in ( select distinct sno from sc where cno='C002')distinct 去重的作用...
2020-04-21 20:44:24
8225
原创 【数据库 Mysql查询系列】在sc表 中查询平均成绩高于75分的学生。
和之前发的博文中涉及到的sc 表一样(本文不再展示表内容)直接上代码select sno 学号, avg(ifnull(grade,0)) 平均成绩from sc group by snohaving avg(ifnull(grade,0))>75;...
2020-04-21 20:40:48
9120
2
原创 【数据库 Mysql查询系列】--统计各专业的学生选课的平均成绩,如果某专业尚未有任何学生选修课程或成绩为空时,平均分计为0。输出结果集按照major表中的mno升序排序。
涉及到的表(三表查询)代码如下:select mname 专业,ifnull(avg(grade),0)平均成绩from major left outer join( select mno,grade from stu,sc where stu.sno=sc.sno)as a on major.mno=a.mnogroup by major.mnoorder by...
2020-04-21 20:37:34
10941
2
原创 【数据库 Mysql查询系列】--检索出stu表中‘计算机工程’或‘软件工程’专业的学生的记录,结果集按学号升序排序。
涉及到的两个表:代码如下:select sno as 学号,sname as 姓名,sex as 性别,mname as 专业from stu,majorwhere stu.mno=major.mno and mname in ('计算机工程','软件工程')order by sno;...
2020-04-21 20:33:54
6782
2
原创 利用正则表达式,使用re模块解析网页数据
re库的使用:可以用于字符串匹配接下来用这种方法分析某大学的招生信息网数据*第一步:*打开网页——>查看网页源代码——>搜索网页里的部分文字,若存在,则直接get其网址(url)即可*第二步:*打开开发者工具——>Elements——>利用元素选择器找到你所要爬取信息的位置——>如图找到了我要爬取的位置本文会用到的匹配字符及正则表达式直接上代码叭imp...
2020-03-19 16:42:53
1581
原创 爬取京东商品评价
方法一import requestsimport pandas as pd import jsonimport time#获取评价数据,返回结果为jsondef get_page(url): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.3...
2020-03-16 16:52:41
885
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人