单表查询
0.建表book,并向表中插入数据CREATE TABLE book (bk_name CHAR ( 20 ) NOT NULL,author CHAR ( 15 ),press CHAR ( 20 ),price FLOAT ( 6, 2 ),pub_date date);insert into book values('倚天屠龙记','egon','北京工业地雷出版社','70','2019-7-1');insert into book values('九阳神功','alex','人民音乐不好听出版社','5','2018-7-4');insert into book values('九阴真经','yuan','北京工业地雷出版社','62','2017-7-12');insert into book values('九阴白骨爪','jinxin','人民音乐不好听出版社','40','2019–8-7');insert into book values('独孤九剑','alex','北京工业地雷出版社','12','2019-9-1');insert into book values('降龙十巴掌','egon','知识产权没有用出版社','20','2019-7-5');insert into book values('葵花宝典','yuan','知识产权没有用出版社','30','2019-8-2');1.查询egon写的所有书和价格select bk_name,price from book where author = 'egon';2.找出最贵的图书的价格select max(price) from book;select price from book order by price desc limit 1;3.求所有图书的均价select avg(price) as book_avg_price from book4.将所有图书按照出版日期排序select * from book order by pub_date;5.查询alex写的所有书的平均价格select avg(price) as avg_price from book group by author having author = 'alex';select avg(price) avg_price from book where author = 'alex';6.查询人民音乐不好听出版社出版的所有图书select bk_name from book where press = '人民音乐不好听出版社';7.查询人民音乐出版社出版的alex写的所有图书和价格select bk_name,price from book where press = '人民音乐不好听出版社' and author = 'alex';8.找出出版图书均价最高的作者select author,avg(price) as avg_price from book group by author order by avg(price) desc limit 1;9.找出最新出版的图书的作者和出版社select author,press from book order by pub_date desc limit 1;10.显示各出版社出版的所有图书select press,group_concat(bk_name) as book_name from book group by press11.查找价格最高的图书,并将它的价格修改为50元beginselect max(price) from book;update book set price=50 where price = 62;commit12.删除价格最低的那本书对应的数据begin;select min(price) from book;delete from book where price = 5;commit;13.将所有alex写的书作业修改成alexsbupdate book set author = 'alexsb' where author = 'alex';14.select year(publish_date) from book自己研究上面sql语句中的year函数的功能,完成需求:将所有2017年出版的图书从数据库中删除select bk_name,year(pub_date) as yearc from book where year(pub_date) = '2017';delect from book where year(pub_date) = '2017';15.有文件如下,请根据[链接](https://www.cnblogs.com/Eva-J/articles/9772614.html)自学pymysql模块,使用python写代码将文件中的数据写入数据库学python从开始到放弃|alex|人民大学出版社|50|2018-7-1学mysql从开始到放弃|egon|机械工业出版社|60|2018-6-3学html从开始到放弃|alex|机械工业出版社|20|2018-4-1学css从开始到放弃|wusir|机械工业出版社|120|2018-5-2学js从开始到放弃|wusir|机械工业出版社|100|2018-7-30详见py文件
