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
5,63 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 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 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 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 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) 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 TABLE OF CONTENTS THANKFUL WORD REPORT COMPLETED AT TON DUC THANG UNIVERSITY TEACHER’S CONFIRMATION AND ASSESSMENT SECTION SUMMARY TABLE OF CONTENTS LIST OF ABBREVIATION LIST OF DIAGRAMS, CHARTS AND TABLES 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 LIST OF ABBREVIATION 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 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 19 Result of example table Product: Picture Product table Create required procedure: (Choosing option 2) Picture Procedure 20 Result: Picture Invoice table after executing procedure Create required function: (Choosing option 1) Picture Function Result: Picture 10 R1’s row for comparison 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 the following requirements: (1 point) 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 14 Solution: Draw ERD model: Picture ERD model 15 Relational model: Picture Relational model 16 Create database, table and insert datas: Picture Create database and tables (1) 17 Picture Create database and tables (2) 18 Picture Inserting datas 19 Result of example table Product: Picture Product table Create required procedure: (Choosing option 2) Picture Procedure 20 Result: Picture Invoice table after executing procedure Create required function: (Choosing option 1) ... database system with ERD model and Relational model, simple queries Chapter 3: Using Java to behaving some queries related to SQL and database with maven project 12 CHAPTER 2: Supermarket database system. .. 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... day month year (sign and write full name) SUMMARY The assignment is built for the purpose of testing database? ??s knowledge about erd model and relational model, but also for consolidating knowledge