Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 33 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
33
Dung lượng
1,35 MB
Nội dung
1 VIETNAM GENERAL CONFEDERATION OF LABOR TON DUC THANG UNIVERSITY FACULTY OF INFORMATION TECHNOLOGY THE PROGRESS EXERCISE FOR DATABASE SUMMARY OF ALL Instructors: MR.MAI VĂN MẠNH Student: MAI BẢO THẠCH – 520H0490 Class: 20H50304 Course: HO CHI MINH CITY, 2021 0 24 VIETNAM GENERAL CONFEDERATION OF LABOR TON DUC THANG UNIVERSITY FACULTY OF INFORMATION TECHNOLOGY THE PROGRESS EXERCISE FOR DATABASE SUMMARY OF ALL Instructor: MR MAI VĂN MẠNH Student: MAI BẢO THẠCH – 520H0490 Class: 20H50304 Course: HO CHI MINH CITY, 2021 0 24 THANKFUL WORD After working for a whole semester with the enthusiastic help and support of Mr Mai Văn Manh, I was able to complete the report in the most complete and effective way His teaching has given our students a lot of knowledge as well as full skills in the specialized subject Although couple of months is quite short, but that time has also helped me to easily approach the major step by step with a solid foundation, especially with the encouragement and help from seasoned lecturers I sincerely thank 0 REPORT COMPLETED AT TON DUC THANG UNIVERSITY I hereby declare that this is my own report and is under the guidance of Mr Mai Văn Mạnh The research contents and results in this topic are honest and have not been published in any form before The data in the tables for analysis, comments and evaluation are collected by the author himself from different sources, clearly stated in the reference section In addition, the project also uses a number of comments, assessments as well as data of other authors, other agencies and organizations, with citations and source annotations If I find any fraud I take full responsibility for the content of my report Ton Duc Thang University is not related to copyright and copyright violations caused by me during the implementation process (if any) Ho Chi Minh city, 12 May, 2022 Author (sign and write full name) Mai Bảo Thạch 0 TEACHER’S CONFIRMATION AND ASSESSMENT SECTION Confirmation section of the instructors _ _ _ _ _ _ _ Ho Chi Minh city, day month year (sign and write full name) The evaluation part of the lecturer marks the report _ _ _ _ _ _ _ Ho Chi Minh city, day month year (sign and write full name) 0 SUMMARY The assignment is built for the purpose of testing database’s knowledge about erd model and relational model, but also for consolidating knowledge after studying at school The content of the assignment revolves around reviewing the basic knowledge of the logic SQL syntaxes and logic query as well as coding implementation for connect and using database throughout Java and Python Regarding the research method, the assignment is based on the learned knowledge, lecture slides, and textbooks given by the lecturer during the learning process The result obtained after this assignment is the knowledge that can be consolidated in the most general way as well as in place of the assignment of the 1st term during the period of extremely stressful epidemic developments 0 TABLE OF CONTENTS THANKFUL WORD REPORT COMPLETED AT TON DUC THANG UNIVERSITY .4 TEACHER’S CONFIRMATION AND ASSESSMENT SECTION SUMMARY TABLE OF CONTENTS .7 LIST OF ABBREVIATION LIST OF DIAGRAMS, CHARTS AND TABLES .8 CHAPTER 1: WORKING ARRANGEMENT 1.1 Introduction of other chapters: CHAPTER 2: Supermarket database system with ERD model and Relational model, simple queries 10 CHAPTER 3: Using Java to behaving some queries related to SQL and database with maven project .21 REFERENCES 31 APPENDIX 32 0 LIST OF ABBREVIATION 0 LIST OF DIAGRAMS, CHARTS AND TABLES Picture ERD model 14 Picture Relational model 15 Picture Create database and tables (1) .16 Picture Create database and tables (2) .17 Picture Inserting datas .18 Picture Product table .19 Picture Procedure 19 Picture Invoice table after executing procedure 20 Picture Function 20 Picture 10 Price of R1 receipt 21 Picture 11 R1’s row for comparison 21 Picture 12 Trigger 21 Picture 13 Result on subtracting on R1’s quantity .22 Picture 14 Create database 24 Picture 15 Define path connection and login information 24 Picture 16 Result of creating database .25 Picture 17 Create Employee table 25 Picture 18 Result in screen 25 Picture 19 Result in MSSQL 26 Picture 20 Employee class 27 Picture 21 Inserting method .28 Picture 22 Reading and returning method 29 Picture 23 Reading an employee's information by specified ID method 29 Picture 24 Updating an employee method 30 Picture 25 Deleting an employee method 30 0 10 Picture 26 Calling method in main() 31 Picture 27 Result on screem of inserting method 31 Picture 28 Result on MSSQL of inserting method .31 Picture 29 Result on screem of reading and returning method 32 Picture 30 Result on screem of returning an employee by ID method .32 Picture 31 Result of updating mehod on screen 32 Picture 33 Result of deleting on MSSQL 32 Picture 32 Result of deleting on screen 32 Picture 34 Result of updating mehod on MSSQL 32 0 19 Result of example table Product: Picture Product table Create required procedure: (Choosing option 2) Picture Procedure 0 20 Result: Picture Invoice table after executing procedure Create required function: (Choosing option 1) Picture Function Result: Picture 10 R1’s row for comparison 0 13 Use SQL language to fulfill the following requirements for the above relational model: (1) a Create Database b Create table c Add at least 10 datarow to each table Create a procedure for one of the following requirements: (1 point) a a Create a new receipt b Add data to the invoice c Add data to the product Create a function for one of requirements: (1 point) the following a Indicate the total amount for a certain receipt b Indicate the total amount for a certain invoice Create a trigger for one of the following requirements: (1 point) a Update the quantity and price for the product when it is imported For example, in the receipt “PN01”, enter the PEPSI product with the quantity of 10 and the price of 10,000, then increase the quantity of PEPSI by 10 in the Product table and update the new price to 10,000 b Update the quantity for the product when a sale is made For example, in a invoice “PB01” that sells a PEPSI product in quantity of 10, subtract this quantity of PEPSI from the Product table 0 14 Solution: Draw ERD model: Picture01 ERD model 0 15 Relational model: Picture Relational model 0 16 Create database, table and insert datas: 0 Picture Create database and tables (1) 0 17 0 Picture Create database and tables (2) 0 18 Picture Inserting datas 0 19 Result of example table Product: 0 Picture Product table Create required procedure: (Choosing option 2) Picture Procedure 0 20 Result: Picture Invoice table after executing procedure Create required function: (Choosing option 1) 0 ... behaving some queries related to SQL and database with maven project 0 12 CHAPTER 2: Supermarket database system with ERD model and Relational model, simple queries PART 1: (6 POINTS) Given the following... of updating mehod on MSSQL 32 0 11 CHAPTER 1: WORKING ARRANGEMENT 1.1 Introduction of other chapters: Chapter 2: Supermarket database system with ERD model and Relational model, simple queries. .. Introduction of other chapters: CHAPTER 2: Supermarket database system with ERD model and Relational model, simple queries 10 CHAPTER 3: Using Java to behaving some queries related