1. Trang chủ
  2. » Luận Văn - Báo Cáo

the progress exercise for database summary of all

32 0 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề The Progress Exercise for Database
Tác giả Mai Bao Thach
Người hướng dẫn MR. Mai Van Manh
Trường học Ton Duc Thang University
Chuyên ngành Database
Thể loại Summary
Năm xuất bản 2021
Thành phố Ho Chi Minh City
Định dạng
Số trang 32
Dung lượng 4,06 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

29 Picture 24 Updating an employee method.... When a customer makes a purchase, the system will print out a invoice that includes information about the invoice code, customer, products,

Trang 1

VIETNAM GENERAL CONFEDERATION OF LABOR

TON DUC THANG UNIVERSITY

FACULTY OF INFORMATION TECHNOLOGY

DAL HOC TON BUC THANG THE PROGRESS EXERCISE FOR DATABASE

SUMMARY OF ALL

Instructors MR.MAI VAN MANH Student MAI BẢO THẠCH - 520H0490

C7ass: 20H50304 Course:

HO CHI MINH CITY, 2021

Trang 2

VIETNAM GENERAL CONFEDERATION OF LABOR

TON DUC THANG UNIVERSITY

FACULTY OF INFORMATION TECHNOLOGY

BAI HOC TON BUC THANG TON DUC THANG UNIVERSITY

THE PROGRESS EXERCISE FOR DATABASE

SUMMARY OF ALL

Instructor: MR MAI VAN MANH Student: MAI BAO THACH - 520H0490

Class: 20H50304 Course: 24

HO CHI MINH CITY, 2021

Trang 3

THANKFUL WORD

After working for a whole semester with the enthusiastic help and support

of Mr Mai Van 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

Trang 4

REPORT COMPLETED AT TON DUC THANG

UNIVERSITY

I hereby declare that this is my own report and is under the guidance of

Mr Mai Van Manh 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 copynght violations caused by me during the implementation process (if any)

Ho Chi Minh city, 12 May, 2022

Author (sign and write full name)

Mai Bao Thach

Trang 5

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)

Trang 7

TABLE OF CONTENTS

THANKFUL WORD e

REPORT COMPLETED AT TON DỤC THANG UNIVERSITY

TEACHERS CONFIRMATION AND ASSESSMENT SECTION

ˆ)ji0n 001959 e-.-

Trang 8

LIST OF ABBREVIATION

Trang 9

LIST OF DIAGRAMS, CHARTS AND TABLES

II1)01110182)99541:1::.iNEYniddầẨẨầẢÝÝẢẢẢẢẢ 14 Picture 2 RelatHonal modelL - c c3 1+2 1121211112111 111511111111 11 111g Hee 15 Picture 3 Create database and tables (Ï) c1 22 2211221112222 2 21x re 16 Picture 4 Create database and tables (2) -.- L2 211211121112 225 21 key 17 Picture 5 Inserting đafa§ c1 2212211211 1121215 1111118121011 11k key 18 II/1011808x19901L57.100) An an aẢ3 19 IDI/)00)308xá, c0 Nn - -i 19 Picture 8 Invoice table after executing procedure -cc sec c2 se: 20 Pacture 9 Function Loi ae 20 Picture 10 Price of RI receIp ccc 2 12211211122 1221225511111 2n kg 21 Picture 11 R1’s row ÍoT cOIDATISOT 0 20 2222221112111 1221121112111 Hy re 21 Picture 12 Trigger 2.0.0 ccc cc ccceecneecneeceeceseetsecnsecesecesstessetieseessieesesies 21 Picture I3 Result on subtracting on RÏ”s quantity 2c 222cc sex: 22 Picture 14 Create database ng HH 1011111111211 1111 kg HH 24 Picture 15 Define path connection and logIn Informafion -. -+-+++ +5 +2 24 Picture 16 Result of creating database 0.0.00 ccc ccc cece te 2 v2 He Hsớy 25 Picture 17 Create Employee table 0.00occcccccccc ccc cecceceseceeeetteeeeesteeeentaeeeees 25 I)01181.0 (21010000 8N e 25 Picture L9 Result in MSSQL LG Q21 12111 1911110111101 11 011K E ng kg kà 26 IIii5022085)41010 4158/12 8N 27 Picture 2l Inserting method - - 221221121212 121 1111112512111 51115581112 28 Picture 22 Reading and returning method - + 2c 11231211121 vs xe, 29 Picture 23 Reading an employee's information by specified ID method 29 Picture 24 Updating an employee method cece cece ceteetseeteeentsenes 30 Picture 25 Deleting an employee method cece cece ecteeetseeseetseessees 30

Trang 10

10

Picture 26 Calling method In maim() -.- - 2E 22 2122222232212 E32 rk2 31 Picture 27 Result on screem of inserting method 0 00 ccc c2 2s c2: 31 Picture 28 Result on MSSQL, ofinserting method c cect cette ene 31 Picture 29 Result on screem o£reading and returning method - 32 Picture 30 Result on screem of returning an employee by ID method 32 Picture 31 Result oÊupdating mehod ơn screen c.c c2 2e e2 32 Picture 33 Result of deleting on MSSQL - c2 2.11122122221121 15 2111 rrrey 32 Picture 32 Result of deleting on screen óc 12.11222222 11 22x yky 32 Picture 34 Result of updating mehod on MSSQL, c 2c S2 ssxv2 32

Trang 11

11

CHAPTER 1: WORKING ARRANGEMENT

1.1 Introduction of other chapters:

Chapter 2: Supermarket 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

Trang 12

12

CHAPTER 2: Supermarket database system with ERD model

and Relational model, simple queries

PART 1: (6 POINTS)

Given the following specification:

A supermarket needs to build an item management system The supermarket currently has the following activities: Supermarket imports products from suppliers The suppliers offer a variety of products in varying quantities Each product needs to be stored with product code, product name, unit, quantity, and price Each product is made by only one manufacturer The information of manufacturer is: manufacturer code, manufacturer name, nationality When the products are imported, it is necessary to save the receipt, including information such as: receipt code, imported products, supplier, quantity, price, import date The information about the supplier is the supplier code, full name, address

Supermarkets have many sales counters, but each product is only sold at only one counter Information of counter includes counter number, counter name, location

Customers will go to the supermarket to buy products When a customer makes a purchase, the system will print out a invoice that includes information about the invoice code, customer, products, quantity, and price Customer information includes customer code, customer name, address

1 Draw ERD model (1 point)

2 Convert the ERD model to a relational model (1 point)

Trang 13

c Add at least 10 datarow to each table

4 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

5 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

6 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 “PNO1”, 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 “PBO1” that sells a PEPSI product in quantity of 10, subtract this quantity

of PEPSI from the Product table

Trang 15

Picture 2 Relational model

ManuName nvarchar(255) Nationality nvarchar(255) ProCode varchar(32)

Trang 16

primary key(SupCode, RecCode),

constraint FK_Dis_Sup foreign key(SupCode) references SuppLlier(SupCode), constraint FK_Dis_Rec foreign key(RecCode) references Receipt(RecCode)

y

Trang 17

primary key(ProCode, RecCode),

constraint FK_Con_Pro foreign key(ProCode) references Product(ProCode),

constraint FK_Con_Rec foreign key(RecCode) references Receipt(RecCode),

Trang 18

18

Product ('P1l', ‘Coca Cola’, ‘Bins’,

D ); ('P3', ‘Chilli sauce’, ‘Bottles’, Py }›

('P4', ‘Yakurt', ‘Tins', 2 ), ('PS', ‘TH True Milk', 'Tins', 1 )› ('P6', 'Soju',

"Botttes"', R ), ('P7', 'Aquafina', 'Cartons'

('P8', ‘Isolate Whey Protetn', ‘Bottles’,

('P10', ‘Fish Oil', ‘Bottles’,

('M5', 'HTTE-Jtnro GROUP', 'Korea', 'P6'), ('M6', 'TH Group'; N'Việẹt Nam', 'P5'), ('M7', 'Yakurt Honsha

d Danone', 'Japan', 'P4'), ('M8', 'ChoLimex Food', N'Viet Nam‘, 'P3'),

('M9', 'Acecook', N'Viẹt Nam', 'P2'), ('M10 ', 'Coca-Cotla', 'USA', 'P1')

Manufacturer

Supptter ('S1', ‘James Hamet', 'New York city'), ('S2', ‘Dillon Ben',

('S3', 'Devin Booker', 'Los Angetes city'), ('S4', 'Jeremey Janes', ‘Chicago city'),

('S5', ‘Mae Bo Taek', 'Andong ctty'), ('S6', N'Ngô Gia Lâm', N'Hồ Chí Minh ctty'), ('S7', ‘Takeshi 1nazuna ' 'Tokyo'), ('S8', N'Phạm Đình Tân', N'Hà Nột ctty'),

('S9', N'Lê Gia Khiêm', N'Đà Nẵng city'), ('S10', ‘Jordan Clarkson', ‘Utah city')

Customer ('C1', 'Jeddy CoadLter', ‘'Disl'), ('C2', ‘Zach Lavine’, ‘Dis4'), ('C3', 'Jrue

Holiday’, ‘Dis7'), ('C4', ‘Kyle Kuzma', 'Dis7'), ('C5', 'Austin Reeves', 'Dis8'),

('C6 "Anthony Edward *D(s1'), ('C7', 'Andrew Wiggins', 'DLs12'), ('C8', ‘Rudy Gobert', ‘DisTP'), ('C9', ‘Megan Fox', ‘DisGV'), (‘'C10', ‘Tyler Herro', 'Dis2')

Trang 19

19

Result of example table Product:

2 P10 FishOil Bottles 420000 500

6 P5 TH True Milk Tins 10000 500

7 P6 Soju Bottles 70000 500

9 P8 Isolate Whey Protein Bottles 1450000 500

Picture 6 Product table

4 Create required procedure: (Choosing option 2)

Trang 20

Picture 8 Invoice table after executing procedure

5 Create required function: (Choosing option 1)

Trang 21

@procode ProCode SaleCounter

Trang 22

22

CHAPTER 3: Using Java to behaving some queries related to

SQL and database with maven project

Trang 23

23

2 Create a table called Employee contaming the necessary information of an employee (use at least 4 columns, choose yourself) After starting, the program will check, if there is no database, it will create the database and table automatically

3 Create the Employee class to store corresponding information in employee table

4 Write independent methods that perform the following functions to interact with the

database:

4.1 Amethod to insert at least 5 employees into the table

4.2 Amethod that reads and returns a list of employees

4.3 Amethod that reads and returns employee based on id

4.4 A method that updates an employee, returning true/false for the update result 4.5 Amethod that deletes an employee, returns true/false for the updated result

5 Call all the above functions in the main method to test, print the results to the screen after each function

Solution:

Trang 26

27

3 Employee class:

Employee rao

Trang 27

28

Inserting method:

Trang 28

29

Reading and returning method:

Picture 22 Reading and returning method

Reading an employee's information by specified ID method:

Picture 23 Reading an employee's information by specified 1D method

Trang 29

30

Updating an employee method:

Picture 24 Updating an employee method

Deleting an employee method:

Picture 25 Deleting an employee method

Picture 26 Calling method in main()

Trang 30

31

5 Running methods in main and results:

Result on inserting method:

37, phone=12}

9, phone=á}

hione“11 phone=z2

Picture 28 Result on MSSQL of inserting method

Result on reading and returning method:

Trang 31

Result on deleting method:

Picture 31 Result of updating mehod on screen

2Pictur£32 ReEudupƒ updatig mehe@d on MISSQL Picture 30 Result on screem oƒ returning an employee by ID method

REFERENCES

Picture 33 Result of deleting on screen

EB Results gil Messages

james 37 12 E2 David 30 4

E4 Janna 27 2

Trang 32

33

APPENDIX

Ngày đăng: 26/09/2024, 16:19

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w