diff --git "a/\350\224\241\347\216\256\351\223\255/20240914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\345\206\215\345\274\272\345\214\226.md" "b/\350\224\241\347\216\256\351\223\255/20240914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\345\206\215\345\274\272\345\214\226.md" index 1f65f56ac93aa845655723cda9de31895d5d46c6..e6067766a1aab69d4db1861ebc536f10aff37a6e 100644 --- "a/\350\224\241\347\216\256\351\223\255/20240914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\345\206\215\345\274\272\345\214\226.md" +++ "b/\350\224\241\347\216\256\351\223\255/20240914 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\345\206\215\345\274\272\345\214\226.md" @@ -2,170 +2,166 @@ ### 网上书店管理系统 -1. ##### 实体表结构: - - - 分类表(classifys) - - | 分类表(classifys) | | - | --------------------- | ----------------------- | - | 分类编号(classify_id) | 分类名称(classify_name) | - | 1 | 计算机 | - | 2 | 科技 | - | 3 | 军事 | - | 4 | 经济 | - | 5 | 文学 | - | 6 | 艺术 | - - - 书店表(bookstore) - - | 书店表(bookstore) | | - | ---------------------- | ------------------------ | - | 书店编号(bookstore_id) | 书店名称(bookstore_name) | - | 1 | 晓荷书屋 | - | 2 | 书笺小驿 | - | 3 | 曦林书苑 | - | 4 | 百草阁 | - | 5 | 济世书屋 | - | 6 | 新华书店 | - - - 角色信息表(roles) - - | 角色信息表(roles) | | - | ----------------- | ------------------- | - | 角色编号(role_Id) | 角色名称(role_name) | - | 1 | 管理员 | - | 2 | 普通用户 | - | 3 | VIP会员 | - | 4 | SVIP会员 | - | 5 | VVIP会员 | - | 6 | 终身会员 | - - - 用户信息表(users) - - | 用户信息表(users) | | | | | | | | - | ----------------- | ------------------- | -------------- | -------------- | ------------- | -------------- | ------------------ | ----------------- | - | 用户编号(user_id) | 用户姓名(user_name) | 性别(user_sex) | 年龄(user_age) | 账号(account) | 密码(password) | 图片编号(image_id) | 角色编号(role_Id) | - | 1 | 肖飞鹏 | 女 | 18 | xiaofeipeng | 123456 | 1 | 6 | - | 2 | 叶功照 | 男 | 19 | yegongzhao | 123456 | 2 | 5 | - | 3 | 卢比伦 | 男 | 20 | lubilun | 123456 | 3 | 4 | - | 4 | 陈俊杰 | 女 | 18 | chenjunjie | 123456 | 4 | 3 | - | 5 | 刘文辉 | 男 | 20 | liuwenhui | 123456 | 5 | 2 | - | 6 | 蔡玮铭 | 男 | 19 | caiweiming | 123456789 | 6 | 1 | - - - 评论信息表(discuss) - - | 评论信息表(discuss) | | | | | - | -------------------- | ---------------------- | ---------------------- | ----------------- | ----------------- | - | 评论编号(discuss_id) | 评论内容(discuss_text) | 评论时间(discuss_time) | 图书编号(book_id) | 用户编号(user_id) | - | 1 | 666 | 2024-9-13 04:32 | 2 | 3 | - | 2 | 7777 | 2024-9-13 07:32 | 2 | 2 | - | 3 | 88888 | 2024-9-13 08:32 | 1 | 1 | - | 4 | 999999 | 2024-9-13 09:32 | 1 | 4 | - | 5 | 1111111 | 2024-9-13 10:32 | 5 | 1 | - | 6 | 23333333 | 2024-9-14 11:32 | 3 | 5 | - - - 图片表(images) - - | 图片表(images) | | | | - | ------------------ | -------------------- | ----------------------- | --------------------- | - | 图片编号(image_id) | 图片名称(image_name) | 图片地址(image_address) | 上传时间(upload_time) | - | 1 | 111.jpg | images/user | 2024-9-13 04:32 | - | 2 | 222.jpg | images/user | 2024-9-13 07:32 | - | 3 | 333.jpg | images/user | 2024-9-13 08:32 | - | 4 | 444.jpg | images/user | 2024-9-13 09:32 | - | 5 | 555.jpg | images/user | 2024-9-13 10:32 | - | 6 | 666.jpg | images/user | 2024-9-14 11:32 | - | 7 | 667.jpg | images/book | 2024-9-15 11:32 | - | 8 | 668.jpg | images/book | 2024-9-16 11:32 | - | 9 | 669.jpg | images/book | 2024-9-17 11:32 | - | 10 | 670.jpg | images/book | 2024-9-18 11:32 | - | 11 | 671.jpg | images/book | 2024-9-19 11:32 | - | 12 | 672.jpg | images/book | 2024-9-20 11:32 | - - - 图书信息表 (books) - - | 图书信息表 (books) | | | | | | | | | | | | | | - | ------------------ | ------------------- | ------------------- | ----------- | ------------ | ------------ | ------------------ | ------------- | -------------------------- | -------------- | ------------------------------------------------------------ | ------------------ | ---------------------- | -------- | - | 图书编号(book_id) | 图书名称(book_name) | 作者编号(author_id) | 价格(price) | 数量(number) | 状态(status) | 出版社(publisher) | 版次(edition) | 出版日期(publication_date) | ISBN书号(ISBN) | 图书简介(abstract) | 图片编号(image_id) | 书店编号(bookstore_id) | 类别编号 | - | 1 | 计算机专题制图 | 1 | 28.50 | 100 | 1 | 气象出版社 | 第一版 | 2006-7-1 | 9787502941444 | 计算机专题制图是利用计算机技术,从理论和技术的角度来研究专题地图的学科。本书介绍了专题制图的特点、方法和设计原理等,以及CorelDRAW 10在计算机专题制图中的应用和技巧。本书内容由浅入深、循序渐进,可以作为地理科学、资源环境与城乡规划、地图学、遥感和地理信息系统专业的教材,也适用于测绘、旅游、园林景观、城市规划设计等专业的高等院校学生使用。 | 7 | 6 | 1 | - | 2 | 经济中国 | 2 | 36.00 | 50 | 1 | 中央民族大学出版社 | 第三版 | 2010-9-3 | 9787811084955 | 经济学是工业优选国家提出的,但中国古来就有丰富的经济思想,引进并分析、消化外国经济学说,继承中国古代经济思想,是中国经济学的必要条件。确立劳动者为中国经济主体,概括其经济意识,正视现实矛盾,揭示现象中的本质,得出规律性认识,以此指导中国经济,是中国经济学研究的内容。这是一个大项目、大任务,需全体中国经济学者共同努力而成就。中央民族大学经济学院为庞大中国经济学界之一员,开此《经济中国》,以为创建、发展中国经济学辟一园地,与同仁共耕耘。 | 12 | 2 | 4 | - | 3 | 军事夜话 | 3 | 31.83 | 20 | 1 | 三联书店 | 第一版 | 2012-11-1 | 9787108040848 | 《军事夜话》收录宋晓军从2007年到2011年四五年间撰写的有关军事题材的文章。主题明确,内容丰富,且有睿智。作者长期主持如“军事聊天室”一类形式新颖的栏目,拥有众多追随者,其军事评论富有远见与理性,讲解原理细致深入,颇具战略眼光和国际视野。 | 11 | 4 | 3 | - | 4 | 科技英语 | 4 | 36.00 | 20 | 1 | 北京理工大学出版社 | 第二版 | 2012-11-2 | 9787568272452 | 本教材选取航天科技领域学术期刊或学术会议论文集中的真实语料,以话题进行单元划分。每个单元选取一种科技英语交流中典型的体裁类型语篇,如实验报告、项目书、文献综述、研究论文等,同时每个语篇中包含某种或几种科技语篇中常见的表达方式,如下定义、原理描述、图表描述 | 10 | 3 | 2 | - | 5 | 艺术概论 | 5 | 102.60 | 5 | 1 | 清华大学出版社 | 第一版 | 2011-2-1 | 9789571454627 | 本教材选取艺术概论 | 9 | 6 | 6 | - | 6 | 文学论集 | 6 | 39.90 | 20 | 1 | 文化艺术出版社 | 第三版 | 2008-10-1 | 9787503935756 | 本教材选取艺术概论 | 8 | 1 | 5 | - - - 作者信息表(authors) - - | 作者信息表(authors) | | | | | - | ------------------- | --------------------- | ---------------- | ---------------- | ------------------------------------------------------------ | - | 作者编号(author_id) | 作者姓名(author_name) | 性别(author_sex) | 年龄(author_age) | 作者简介(author_abstract) | - | 1 | 孟万忠 | 男 | 40 | 职称:教授 研究方向: 山西,流域,灾害等级,周期规律,霜雪低温灾害 学科领域:中国史,测绘学,大气科学(气象学),地球物理学,教育 所属二级机构:历史地理与环境变迁 | - | 2 | 刘永佶 | 男 | 52 | 当代中国经济研究所所长。他的研究范围涉及经济、政治、哲学、文化等,是一位很有特色和创造精神的学者。公有、民主、自由,是他对社会主义的简要概括。公有即公有经济,民主即民主政治,自由即自由文化,这三者构成社会主义理论、运动、制度的基本要素,也是基本框架 | - | 3 | 宋晓军 | 男 | 53 | 1957年,宋晓军出生,大连水面舰艇学院毕业。 [1] 1976年入伍,曾在海军驱逐舰部队和潜艇部队担任过通讯军官和教官。上世纪90年代中期的大裁军后,转业回到北京,在《舰船知识》做编辑。 1997年起,担任《舰船知识》网络版主编兼网站论坛版主,因此又被《舰船知识》读者称为“网管B”。 | - | 4 | 刘芳 | 女 | 45 | 刘芳,女,二级教授,博士生导师,享受国务院特殊津贴的专家,国家自然科学奖获得者,建国七十周年奖章获得者,IEEE高级会员,现为西安电子科技大学华山特聘教授和学术带头人, | - | 5 | 罗杰波 | 男 | 34 | 罗杰波,男,云南昆明人,欧洲科学院院士,美国国家发明家科学院院士,罗切斯特大学Albert Arendt Hopeman教授、计算机科学教授。 [1] 罗杰波于1984年进入中国科学技术大学无线电系学习,1989年获得学士学位,1992年获得硕士学位;1995年于美国罗切斯特大学获得电子工程博士学位;2011年加入罗彻斯特大学计算机科学系担任教授;2015年被任命为罗切斯特大学数据科学研究所卓越研究员;2022年6月被选为欧洲科学院院士;12月获选为美国国家发明家学院院士。 [2] [6] 罗杰波的研究涉及图像处理、计算机视觉、机器学习、数据挖掘、社交媒体、数字健康等多个前沿领域。 | - | 6 | 丁振海 | 男 | 38 | 历任中共中央马列主义研究院文艺理论组成员,首都钢铁公司政治部理论宣传干部,中国社科院文学研究所《文学评论》杂志编辑,中共中央书记处研究室文化组干部,红旗杂志社科教文部主任,《人民日报》编委、文艺部主任、海外版总编辑。中国作家协会第五届主席团委员,中国报纸副刊研究会会长。 | - - - 订单信息表(orders) - - | 订单信息表(orders) | | | | | | | - | ------------------ | -------------------- | ----------------- | ---------------- | ------------------------------ | ----------------- | ----------------- | - | 订单编号(order_id) | 订单名称(order_name) | 价格(order_price) | 图书数量(number) | 订单地址编号(order_address_id) | 图书编号(book_id) | 用户编号(user_id) | - | 1 | 经济中国 x 2 | 72.00 | 2 | 1 | 2 | 1 | - | 2 | 军事夜话 X 1 | 31.83 | 1 | 2 | 3 | 1 | - | 3 | 计算机专题制图 X 3 | 85.50 | 3 | 3 | 1 | 2 | - | 4 | 艺术概论 X 1 | 102.60 | 1 | 4 | 5 | 2 | - | 5 | 科技英语 X 2 | 72.00 | 2 | 5 | 4 | 3 | - | 6 | 文学论集 X 3 | 119.70 | 3 | 6 | 6 | 3 | - - - 订单地址关联表(order_address) - - | 订单地址关联表(order_address) | | | | | - | ------------------------------ | ------------------------------- | --------------------------- | ------------------------------- | ---------------- | - | 订单地址编号(order_address_id) | 省地址编号(province_address_id) | 市地址编号(town_address_id) | 区地址编号(district_address_id) | 具体信息(detail) | - | 1 | 1 | 1 | 1 | xx小区 | - | 2 | 2 | 2 | 2 | xx小区 | - | 3 | 3 | 3 | 3 | xx小区 | - | 4 | 4 | 4 | 4 | xx小区 | - | 5 | 5 | 5 | 5 | xx小区 | - | 6 | 6 | 6 | 6 | xx小区 | - - - 省地址信息表(province_address) - - | 省地址信息表(province_address) | | - | ------------------------------- | --------------------------------- | - | 省地址编号(province_address_id) | 省地址名称(province_address_name) | - | 1 | 福建省 | - | 2 | 河北省 | - | 3 | 浙江省 | - | 4 | 四川省 | - | 5 | 湖北省 | - | 6 | 甘肃省 | - - - 市地址信息表(town_address) - - | 市地址信息表(town_address) | | - | --------------------------- | ----------------------------- | - | 市地址编号(town_address_id) | 市地址名称(town_address_name) | - | 1 | 龙岩市 | - | 2 | 石家庄市 | - | 3 | 杭州市 | - | 4 | 成都市 | - | 5 | 武汉市 | - | 6 | 兰州市 | - - - 区地址信息表(district_address) - - | 区地址信息表(district_address) | | - | ------------------------------- | --------------------------------- | - | 区地址编号(district_address_id) | 区地址名称(district_address_name) | - | 1 | 新罗区 | - | 2 | 灵寿县 | - | 3 | 上城区 | - | 4 | 金牛区 | - | 5 | 江岸区 | - | 6 | 城关区 | - -2. ##### 表结构截图 - - - ![image-20240914113002047](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240914_1726284606.png) +- 分类表(classifys) + + | 分类表(classifys) | | + | --------------------- | ----------------------- | + | 分类编号(classify_id) | 分类名称(classify_name) | + | 1 | 计算机 | + | 2 | 科技 | + | 3 | 军事 | + | 4 | 经济 | + | 5 | 文学 | + | 6 | 艺术 | + +- 书店表(bookstore) + + | 书店表(bookstore) | | + | ---------------------- | ------------------------ | + | 书店编号(bookstore_id) | 书店名称(bookstore_name) | + | 1 | 晓荷书屋 | + | 2 | 书笺小驿 | + | 3 | 曦林书苑 | + | 4 | 百草阁 | + | 5 | 济世书屋 | + | 6 | 新华书店 | + +- 角色信息表(roles) + + | 角色信息表(roles) | | + | ----------------- | ------------------- | + | 角色编号(role_Id) | 角色名称(role_name) | + | 1 | 管理员 | + | 2 | 普通用户 | + | 3 | VIP会员 | + | 4 | SVIP会员 | + | 5 | VVIP会员 | + | 6 | 终身会员 | + +- 用户信息表(users) + + | 用户信息表(users) | | | | | | | | + | ----------------- | ------------------- | -------------- | -------------- | ------------- | -------------- | ------------------ | ----------------- | + | 用户编号(user_id) | 用户姓名(user_name) | 性别(user_sex) | 年龄(user_age) | 账号(account) | 密码(password) | 图片编号(image_id) | 角色编号(role_Id) | + | 1 | 肖飞鹏 | 女 | 18 | xiaofeipeng | 123456 | 1 | 6 | + | 2 | 叶功照 | 男 | 19 | yegongzhao | 123456 | 2 | 5 | + | 3 | 卢比伦 | 男 | 20 | lubilun | 123456 | 3 | 4 | + | 4 | 陈俊杰 | 女 | 18 | chenjunjie | 123456 | 4 | 3 | + | 5 | 刘文辉 | 男 | 20 | liuwenhui | 123456 | 5 | 2 | + | 6 | 蔡玮铭 | 男 | 19 | caiweiming | 123456789 | 6 | 1 | + +- 评论信息表(discuss) + + | 评论信息表(discuss) | | | | | + | -------------------- | ---------------------- | ---------------------- | ----------------- | ----------------- | + | 评论编号(discuss_id) | 评论内容(discuss_text) | 评论时间(discuss_time) | 图书编号(book_id) | 用户编号(user_id) | + | 1 | 666 | 2024-9-13 04:32 | 2 | 3 | + | 2 | 7777 | 2024-9-13 07:32 | 2 | 2 | + | 3 | 88888 | 2024-9-13 08:32 | 1 | 1 | + | 4 | 999999 | 2024-9-13 09:32 | 1 | 4 | + | 5 | 1111111 | 2024-9-13 10:32 | 5 | 1 | + | 6 | 23333333 | 2024-9-14 11:32 | 3 | 5 | + +- 图片表(images) + + | 图片表(images) | | | | + | ------------------ | -------------------- | ----------------------- | --------------------- | + | 图片编号(image_id) | 图片名称(image_name) | 图片地址(image_address) | 上传时间(upload_time) | + | 1 | 111.jpg | images/user | 2024-9-13 04:32 | + | 2 | 222.jpg | images/user | 2024-9-13 07:32 | + | 3 | 333.jpg | images/user | 2024-9-13 08:32 | + | 4 | 444.jpg | images/user | 2024-9-13 09:32 | + | 5 | 555.jpg | images/user | 2024-9-13 10:32 | + | 6 | 666.jpg | images/user | 2024-9-14 11:32 | + | 7 | 667.jpg | images/book | 2024-9-15 11:32 | + | 8 | 668.jpg | images/book | 2024-9-16 11:32 | + | 9 | 669.jpg | images/book | 2024-9-17 11:32 | + | 10 | 670.jpg | images/book | 2024-9-18 11:32 | + | 11 | 671.jpg | images/book | 2024-9-19 11:32 | + | 12 | 672.jpg | images/book | 2024-9-20 11:32 | + +- 图书信息表 (books) + + | 图书信息表 (books) | | | | | | | | | | | | | | + | ------------------ | ------------------- | ------------------- | ----------- | ------------ | ------------ | ------------------ | ------------- | -------------------------- | -------------- | ------------------------------------------------------------ | ------------------ | ---------------------- | -------- | + | 图书编号(book_id) | 图书名称(book_name) | 作者编号(author_id) | 价格(price) | 数量(number) | 状态(status) | 出版社(publisher) | 版次(edition) | 出版日期(publication_date) | ISBN书号(ISBN) | 图书简介(abstract) | 图片编号(image_id) | 书店编号(bookstore_id) | 类别编号 | + | 1 | 计算机专题制图 | 1 | 28.50 | 100 | 1 | 气象出版社 | 第一版 | 2006-7-1 | 9787502941444 | 计算机专题制图是利用计算机技术,从理论和技术的角度来研究专题地图的学科。本书介绍了专题制图的特点、方法和设计原理等,以及CorelDRAW 10在计算机专题制图中的应用和技巧。本书内容由浅入深、循序渐进,可以作为地理科学、资源环境与城乡规划、地图学、遥感和地理信息系统专业的教材,也适用于测绘、旅游、园林景观、城市规划设计等专业的高等院校学生使用。 | 7 | 6 | 1 | + | 2 | 经济中国 | 2 | 36.00 | 50 | 1 | 中央民族大学出版社 | 第三版 | 2010-9-3 | 9787811084955 | 经济学是工业优选国家提出的,但中国古来就有丰富的经济思想,引进并分析、消化外国经济学说,继承中国古代经济思想,是中国经济学的必要条件。确立劳动者为中国经济主体,概括其经济意识,正视现实矛盾,揭示现象中的本质,得出规律性认识,以此指导中国经济,是中国经济学研究的内容。这是一个大项目、大任务,需全体中国经济学者共同努力而成就。中央民族大学经济学院为庞大中国经济学界之一员,开此《经济中国》,以为创建、发展中国经济学辟一园地,与同仁共耕耘。 | 12 | 2 | 4 | + | 3 | 军事夜话 | 3 | 31.83 | 20 | 1 | 三联书店 | 第一版 | 2012-11-1 | 9787108040848 | 《军事夜话》收录宋晓军从2007年到2011年四五年间撰写的有关军事题材的文章。主题明确,内容丰富,且有睿智。作者长期主持如“军事聊天室”一类形式新颖的栏目,拥有众多追随者,其军事评论富有远见与理性,讲解原理细致深入,颇具战略眼光和国际视野。 | 11 | 4 | 3 | + | 4 | 科技英语 | 4 | 36.00 | 20 | 1 | 北京理工大学出版社 | 第二版 | 2012-11-2 | 9787568272452 | 本教材选取航天科技领域学术期刊或学术会议论文集中的真实语料,以话题进行单元划分。每个单元选取一种科技英语交流中典型的体裁类型语篇,如实验报告、项目书、文献综述、研究论文等,同时每个语篇中包含某种或几种科技语篇中常见的表达方式,如下定义、原理描述、图表描述 | 10 | 3 | 2 | + | 5 | 艺术概论 | 5 | 102.60 | 5 | 1 | 清华大学出版社 | 第一版 | 2011-2-1 | 9789571454627 | 本教材选取艺术概论 | 9 | 6 | 6 | + | 6 | 文学论集 | 6 | 39.90 | 20 | 1 | 文化艺术出版社 | 第三版 | 2008-10-1 | 9787503935756 | 本教材选取艺术概论 | 8 | 1 | 5 | + +- 作者信息表(authors) + + | 作者信息表(authors) | | | | | + | ------------------- | --------------------- | ---------------- | ---------------- | ------------------------------------------------------------ | + | 作者编号(author_id) | 作者姓名(author_name) | 性别(author_sex) | 年龄(author_age) | 作者简介(author_abstract) | + | 1 | 孟万忠 | 男 | 40 | 职称:教授 研究方向: 山西,流域,灾害等级,周期规律,霜雪低温灾害 学科领域:中国史,测绘学,大气科学(气象学),地球物理学,教育 所属二级机构:历史地理与环境变迁 | + | 2 | 刘永佶 | 男 | 52 | 当代中国经济研究所所长。他的研究范围涉及经济、政治、哲学、文化等,是一位很有特色和创造精神的学者。公有、民主、自由,是他对社会主义的简要概括。公有即公有经济,民主即民主政治,自由即自由文化,这三者构成社会主义理论、运动、制度的基本要素,也是基本框架 | + | 3 | 宋晓军 | 男 | 53 | 1957年,宋晓军出生,大连水面舰艇学院毕业。 [1] 1976年入伍,曾在海军驱逐舰部队和潜艇部队担任过通讯军官和教官。上世纪90年代中期的大裁军后,转业回到北京,在《舰船知识》做编辑。 1997年起,担任《舰船知识》网络版主编兼网站论坛版主,因此又被《舰船知识》读者称为“网管B”。 | + | 4 | 刘芳 | 女 | 45 | 刘芳,女,二级教授,博士生导师,享受国务院特殊津贴的专家,国家自然科学奖获得者,建国七十周年奖章获得者,IEEE高级会员,现为西安电子科技大学华山特聘教授和学术带头人, | + | 5 | 罗杰波 | 男 | 34 | 罗杰波,男,云南昆明人,欧洲科学院院士,美国国家发明家科学院院士,罗切斯特大学Albert Arendt Hopeman教授、计算机科学教授。 [1] 罗杰波于1984年进入中国科学技术大学无线电系学习,1989年获得学士学位,1992年获得硕士学位;1995年于美国罗切斯特大学获得电子工程博士学位;2011年加入罗彻斯特大学计算机科学系担任教授;2015年被任命为罗切斯特大学数据科学研究所卓越研究员;2022年6月被选为欧洲科学院院士;12月获选为美国国家发明家学院院士。 [2] [6] 罗杰波的研究涉及图像处理、计算机视觉、机器学习、数据挖掘、社交媒体、数字健康等多个前沿领域。 | + | 6 | 丁振海 | 男 | 38 | 历任中共中央马列主义研究院文艺理论组成员,首都钢铁公司政治部理论宣传干部,中国社科院文学研究所《文学评论》杂志编辑,中共中央书记处研究室文化组干部,红旗杂志社科教文部主任,《人民日报》编委、文艺部主任、海外版总编辑。中国作家协会第五届主席团委员,中国报纸副刊研究会会长。 | + +- 订单信息表(orders) + + | 订单信息表(orders) | | | | | | | + | ------------------ | -------------------- | ----------------- | ---------------- | ------------------------------ | ----------------- | ----------------- | + | 订单编号(order_id) | 订单名称(order_name) | 价格(order_price) | 图书数量(number) | 订单地址编号(order_address_id) | 图书编号(book_id) | 用户编号(user_id) | + | 1 | 经济中国 x 2 | 72.00 | 2 | 1 | 2 | 1 | + | 2 | 军事夜话 X 1 | 31.83 | 1 | 2 | 3 | 1 | + | 3 | 计算机专题制图 X 3 | 85.50 | 3 | 3 | 1 | 2 | + | 4 | 艺术概论 X 1 | 102.60 | 1 | 4 | 5 | 2 | + | 5 | 科技英语 X 2 | 72.00 | 2 | 5 | 4 | 3 | + | 6 | 文学论集 X 3 | 119.70 | 3 | 6 | 6 | 3 | + +- 订单地址关联表(order_address) + + | 订单地址关联表(order_address) | | | | | + | ------------------------------ | ------------------------------- | --------------------------- | ------------------------------- | ---------------- | + | 订单地址编号(order_address_id) | 省地址编号(province_address_id) | 市地址编号(town_address_id) | 区地址编号(district_address_id) | 具体信息(detail) | + | 1 | 1 | 1 | 1 | xx小区 | + | 2 | 2 | 2 | 2 | xx小区 | + | 3 | 3 | 3 | 3 | xx小区 | + | 4 | 4 | 4 | 4 | xx小区 | + | 5 | 5 | 5 | 5 | xx小区 | + | 6 | 6 | 6 | 6 | xx小区 | + +- 省地址信息表(province_address) + + | 省地址信息表(province_address) | | + | ------------------------------- | --------------------------------- | + | 省地址编号(province_address_id) | 省地址名称(province_address_name) | + | 1 | 福建省 | + | 2 | 河北省 | + | 3 | 浙江省 | + | 4 | 四川省 | + | 5 | 湖北省 | + | 6 | 甘肃省 | + +- 市地址信息表(town_address) + + | 市地址信息表(town_address) | | + | --------------------------- | ----------------------------- | + | 市地址编号(town_address_id) | 市地址名称(town_address_name) | + | 1 | 龙岩市 | + | 2 | 石家庄市 | + | 3 | 杭州市 | + | 4 | 成都市 | + | 5 | 武汉市 | + | 6 | 兰州市 | + +- 区地址信息表(district_address) + + | 区地址信息表(district_address) | | + | ------------------------------- | --------------------------------- | + | 区地址编号(district_address_id) | 区地址名称(district_address_name) | + | 1 | 新罗区 | + | 2 | 灵寿县 | + | 3 | 上城区 | + | 4 | 金牛区 | + | 5 | 江岸区 | + | 6 | 城关区 | + +- ![image-20240914113002047](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240914_1726284606.png) diff --git "a/\350\224\241\347\216\256\351\223\255/20240919 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\251\267\346\236\201.md" "b/\350\224\241\347\216\256\351\223\255/20240919 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\251\267\346\236\201.md" new file mode 100644 index 0000000000000000000000000000000000000000..1f506f7e63696b8fe00c88a02c451c918567a46a --- /dev/null +++ "b/\350\224\241\347\216\256\351\223\255/20240919 \347\275\221\344\270\212\344\271\246\345\272\227\347\256\241\347\220\206\347\263\273\347\273\237\347\251\267\346\236\201.md" @@ -0,0 +1,257 @@ +# 课后作业 + +### 网上书店管理系统 + +#### 一、三个模型 + +1. ##### CDM 概念模型 + + ![image-20240919205526074](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409192055125.png) + +2. ##### LDM 逻辑模型 + + ![image-20240919205513614](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409192055668.png) + +3. ##### PDM 物理模型 + + ![image-20240919205450995](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409192054054.png) + +#### 二、sql语句 + +```sql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/19 20:43:26 */ +/*==============================================================*/ + +create database if not exists db; + +use db; + +drop table if exists authors; + +drop table if exists books; + +drop table if exists classifys; + +drop table if exists discuss; + +drop table if exists order_address; + +drop table if exists orders; + +drop table if exists roles; + +drop table if exists users; + +/*==============================================================*/ +/* Table: authors */ +/*==============================================================*/ +create table authors +( + author_id int not null auto_increment, + author_name varchar(10), + author_sex char(1), + primary key (author_id) +); + +/*==============================================================*/ +/* Table: books */ +/*==============================================================*/ +create table books +( + book_id int not null auto_increment, + classifys_id int not null, + author_id int not null, + book_name varchar(20), + price decimal(2), + number int, + status int, + publisher varchar(20), + ISBN varchar(20), + abstract varchar(255), + primary key (book_id) +); + +/*==============================================================*/ +/* Table: classifys */ +/*==============================================================*/ +create table classifys +( + classifys_id int not null auto_increment, + classifys_name varchar(10), + primary key (classifys_id) +); + +/*==============================================================*/ +/* Table: discuss */ +/*==============================================================*/ +create table discuss +( + discuss_id int not null auto_increment, + book_id int not null, + user_id int not null, + discuss_text varchar(255), + discuss_time datetime, + primary key (discuss_id) +); + +/*==============================================================*/ +/* Table: order_address */ +/*==============================================================*/ +create table order_address +( + order_address_id int not null auto_increment, + detail varchar(255), + primary key (order_address_id) +); + +/*==============================================================*/ +/* Table: orders */ +/*==============================================================*/ +create table orders +( + order_id int not null auto_increment, + user_id int not null, + book_id int not null, + order_address_id int not null, + order_name varchar(20), + order_price decimal(2), + number int, + primary key (order_id) +); + +/*==============================================================*/ +/* Table: roles */ +/*==============================================================*/ +create table roles +( + role_id int not null auto_increment, + role_name varchar(10), + primary key (role_id) +); + +/*==============================================================*/ +/* Table: users */ +/*==============================================================*/ +create table users +( + user_id int not null auto_increment, + role_id int not null, + user_name varchar(10), + user_sex char(1), + user_age int, + account varchar(20), + password varchar(20), + primary key (user_id) +); + +alter table books add constraint FK_author foreign key (author_id) + references authors (author_id) on delete restrict on update restrict; + +alter table books add constraint FK_link10 foreign key (classifys_id) + references classifys (classifys_id) on delete restrict on update restrict; + +alter table discuss add constraint FK_link2 foreign key (user_id) + references users (user_id) on delete restrict on update restrict; + +alter table discuss add constraint FK_link3 foreign key (book_id) + references books (book_id) on delete restrict on update restrict; + +alter table orders add constraint FK_link4 foreign key (user_id) + references users (user_id) on delete restrict on update restrict; + +alter table orders add constraint FK_link5 foreign key (book_id) + references books (book_id) on delete restrict on update restrict; + +alter table orders add constraint FK_link6 foreign key (order_address_id) + references order_address (order_address_id) on delete restrict on update restrict; + +alter table users add constraint FK_link foreign key (role_id) + references roles (role_id) on delete restrict on update restrict; +``` + +#### 三、navicat执行 + +![image-20240919205424956](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409192054990.png) + +#### 四、添加测试的数据 + +```sql +-- ---------------------------- +-- Records of authors +-- ---------------------------- +INSERT INTO `authors` VALUES (1, '孟万忠', '男'); +INSERT INTO `authors` VALUES (2, '刘永佶', '男'); +INSERT INTO `authors` VALUES (3, '宋晓军', '男'); + +-- ---------------------------- +-- Records of books +-- ---------------------------- +INSERT INTO `books` VALUES (1, 1, 1, '计算机专题制图', 29.00, 100, 1, '气象出版社', '9787502941444', '计算机专题制图是利用计算机技术,从理论和技术的角度来研究专题地图的学科。本书介绍了专题制图的特点、方法和设计原理等,以及CorelDRAW 10在计算机专题制图中的应用和技巧。本书内容由浅入深、循序渐进,可以作为地理科学、资源环境与城乡规划、地图学、遥感和地理信息系统专业的教材,也适用于测绘、旅游、园林景观、城市规划设计等专业的高等院校学生使用。'); +INSERT INTO `books` VALUES (2, 2, 2, '科技英语', 36.00, 20, 1, '北京理工大学出版社', '9787568272452', '本教材选取航天科技领域学术期刊或学术会议论文集中的真实语料,以话题进行单元划分。每个单元选取一种科技英语交流中典型的体裁类型语篇,如实验报告、项目书、文献综述、研究论文等,同时每个语篇中包含某种或几种科技语篇中常见的表达方式,如下定义、原理描述、图表描述'); +INSERT INTO `books` VALUES (3, 3, 3, '军事夜话', 32.00, 20, 0, '三联书店', '9787108040848', '《军事夜话》收录宋晓军从2007年到2011年四五年间撰写的有关军事题材的文章。主题明确,内容丰富,且有睿智。作者长期主持如“军事聊天室”一类形式新颖的栏目,拥有众多追随者,其军事评论富有远见与理性,讲解原理细致深入,颇具战略眼光和国际视野。'); + +-- ---------------------------- +-- Records of classifys +-- ---------------------------- +INSERT INTO `classifys` VALUES (1, '计算机'); +INSERT INTO `classifys` VALUES (2, '科技'); +INSERT INTO `classifys` VALUES (3, '军事'); + +-- ---------------------------- +-- Records of discuss +-- ---------------------------- +INSERT INTO `discuss` VALUES (1, 2, 1, '666', '2024-09-19 21:31:59'); +INSERT INTO `discuss` VALUES (2, 2, 3, '7777', '2024-09-19 21:32:17'); +INSERT INTO `discuss` VALUES (3, 1, 1, '999999', '2024-09-19 21:32:40'); + +-- ---------------------------- +-- Records of order_address +-- ---------------------------- +INSERT INTO `order_address` VALUES (1, '福建省龙岩市新罗区闽大'); + +-- ---------------------------- +-- Records of orders +-- ---------------------------- +INSERT INTO `orders` VALUES (1, 1, 2, 1, '军事夜话 X 1', 32.00, 1); +INSERT INTO `orders` VALUES (2, 3, 3, 1, '计算机专题制图 X 3', 86.00, 3); + + +-- ---------------------------- +-- Records of roles +-- ---------------------------- +INSERT INTO `roles` VALUES (1, '管理员'); +INSERT INTO `roles` VALUES (2, '普通用户'); +INSERT INTO `roles` VALUES (3, 'VIP会员'); +INSERT INTO `roles` VALUES (4, 'SVIP会员'); +INSERT INTO `roles` VALUES (5, 'VVIP会员'); +INSERT INTO `roles` VALUES (6, '终身会员'); + +-- ---------------------------- +-- Records of users +-- ---------------------------- +INSERT INTO `users` VALUES (1, 6, '肖飞鹏', '女', 18, 'xiaofeipeng', '123456'); +INSERT INTO `users` VALUES (3, 5, '叶功照', '男', 19, 'yegongzhao', '123456'); +``` + +#### 五、使用sql语句,检测,是否满足需求分析中设想的场景 + +```sql +-- 查询订单信息叶功照买过的书包括书籍评论 +select u.user_name '姓名',b.book_name '图书名称',d.discuss_text '评论' from orders o join users u on o.user_id = u.user_id +join discuss d on d.user_id = u.user_id +join books b on b.book_id = o.book_id + where u.user_name = '叶功照'; +``` + +![image-20240919215055795](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409192150817.png) + +```sql + -- 查询肖飞鹏买过的书的信息 + select u.user_name '用户',b.* from orders o join users u on u.user_id = o.user_id + join books b on b.book_id = o.book_id + where u.user_name = '肖飞鹏'; +``` + +![image-20240919214955035](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409192149058.png) diff --git "a/\350\224\241\347\216\256\351\223\255/20240920 \346\225\260\346\215\256\345\272\223\350\247\206\345\233\276.md" "b/\350\224\241\347\216\256\351\223\255/20240920 \346\225\260\346\215\256\345\272\223\350\247\206\345\233\276.md" new file mode 100644 index 0000000000000000000000000000000000000000..43bbf24a55808bb3489ad1fe5147e882e8eec5f2 --- /dev/null +++ "b/\350\224\241\347\216\256\351\223\255/20240920 \346\225\260\346\215\256\345\272\223\350\247\206\345\233\276.md" @@ -0,0 +1,176 @@ +## 课堂笔记 + +#### 视图 + +##### 一、概念: + +视图是一种虚拟的表,是一个为了简化复杂查询语句的书写,另外也提高了数据库一定的安全性。 + +查询是利用sql语句按照用户的需求自定义查询,更加灵活,查一次用一次。select查询的是一个结果集。 + +##### 二、优点: + +1. 简化用户操作 + +2. 多角度查看同一数据 + +3. 提供逻辑独立性 + +4. 保护机密数据 + +5. 更清晰地表达查询 + +##### 三、语法: + +```sql +-- 创建或更新一个视图 +create or replace view 视图名 as select * from 表名 where 条件 + +-- 修改视图名 +rename table 旧视图名 to 新视图名; + +-- 删除视图 +drop view 视图名; + +-- 查询视图 +select * from 视图名; + +-- 查看表和视图的类型及名称 +show full tables; +``` + +## 课后作业 + +###### -- 视图课堂练习 + +1. 创建一个视图,显示所有部门的名称以及属于该部门的员工姓名 + + ```sql + create or replace view v_text as select de.dname 部门名称,em.ename 员工姓名 from dept de join emp em on em.deptno = de.deptno; + ``` + + ![image-20240920104318287](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726800198.png) + + ![image-20240920104809163](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726800489.png) + +2. 创建一个视图,显示员工姓名、职位、薪水和佣金。 + + ```sql + create or replace view v_text2 as select ename 员工姓名,job 职位,sal 薪水,comm 佣金 from emp; + ``` + + ![image-20240920105423980](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726800864.png) + + ![image-20240920105438267](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726800878.png) + +3. 创建一个视图,显示所有薪水大于 20000 的员工姓名、职位和薪水。 + + ```sql + create or replace view v_text3 as select ename 员工姓名,job 职位,sal 薪水 from emp where emp.sal > 20000; + ``` + + ![image-20240920105709995](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726801030.png) + + ![image-20240920105727783](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726801047.png) + +4. 创建按部门分类的员工数量视图 + + ```sql + create or replace view v_text4 as select de.dname 部门,count(em.deptno) 员工数量 from emp em join dept de on de.deptno = em.deptno group by em.deptno; + ``` + + ![image-20240920111306819](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726801986.png) + + ![image-20240920111326420](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726802006.png) + +5. 创建一个视图,显示员工姓名、薪水及其所属的薪资等级。 + + ```sql + create or replace view v_text5 as select em.ename 员工姓名,em.sal 薪水,sa.grade 薪资等级 from emp em join salgrade sa on em.sal between sa.losal and sa.hisal; + ``` + + ![image-20240920111656403](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726802216.png) + + ![image-20240920111705176](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726802225.png) + +6. 创建一个视图,显示每个经理及其直接下属员工的姓名。 + + ```sql + create or replace view v_text6 as select em.ename 经理,em2.ename 员工姓名 from emp em join emp em2 on em2.mgr = em.empno where em.job = '经理'; + ``` + + ![image-20240920113912906](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726803553.png) + + ![image-20240920113928238](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/upgit_20240920_1726803568.png) + +7. 创建一个视图,显示每个部门的名称及其平均薪水。 + + ```sql + create or replace view v_text7 as select de.dname 部门名称,avg(em.sal) 平均薪水 from dept de join emp em on em.deptno = de.deptno group by em.deptno; + ``` + + ![image-20240920121127004](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201211110.png) + + ![image-20240920121220376](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201212394.png) + +8. 创建一个视图,显示在 2001 年以后入职的员工姓名和入职日期。 + + ```sql + create or replace view v_text8 as select ename 员工姓名,hiredate 入职日期 from emp where hiredate > '2001-12-31'; + ``` + + ![image-20240920131508379](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201315466.png) + + ![image-20240920131529689](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201315709.png) + +9. 删除一个已创建的视图。 + + ```sql + drop view v_text8; + ``` + + ![image-20240920131620064](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201316081.png) + +10. 修改第一个视图的名称 + + ```sql + rename table v_text to v_text1; + ``` + + ![image-20240920131841563](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201318583.png) + +11. 修改第二个视图,显示员工姓名、职位、部门。 + + ```sql + create or replace view v_text2 as select em.ename 员工姓名,em.job 职位,de.dname 部门 from emp em join dept de on de.deptno = em.deptno; + ``` + + ![image-20240920132056561](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201320581.png) + + ![image-20240920132129945](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201321966.png) + +###### -- 作业 + +-- 1:查询部门平均薪水最高的部门名称 + +```sql +select de.dname 部门,em.avg 平均薪水 from dept de join (select deptno,avg(sal) avg from emp group by deptno) em on em.deptno = de.deptno order by em.avg desc limit 1; +``` + +![image-20240920133803255](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201338273.png) + +-- 2:查询员工比所属领导薪资高的部门名、员工名、员工领导编号 + +```sql +select de.dname 部门名,em.ename 员工名,em.mgr 员工领导编号 from emp em join dept de on de.deptno = em.deptno where em.sal > (select em2.sal from emp em2 where em2.empno = em.mgr); +``` + +![image-20240920134633967](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201346986.png) + +-- 3:查询工资等级为4级,2000年以后入职的工作地点为上海的员工编号、姓名和工资 + +```sql +select em.empno 员工编号,em.ename 员工姓名,em.sal 薪水 from emp em join dept de on de.deptno = em.deptno join salgrade sa on em.sal between sa.losal and sa.hisal where sa.grade = 4 and em.hiredate > '2000-12-31' and de.loc = '上海'; +``` + +![image-20240920135138462](https://gitee.com/hyo-ja/picture-warehouse/raw/master/images/202409201351483.png)