project report subject databases subject name market online management project

89 4 0
project report subject databases subject name market online management project

Đ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

VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY UNIVERSITY OF ECONOMICS AND LAW PROJECT REPORT Subject: Databases Subject name: Market Online Management Project Lecturers: Lam Hong Thanh TP.HCM, Tháng 05 Năm 2021 download by : skknchat@gmail.com MEMBERS OF GROUP Number Name ID Position Phạm Gia Hoài An K194060840 Leader Trần Thị Diệu Ái K194060842 Member Trần Thị Hà Ly K194060854 Member Nguyễn Mạnh Quang K194060865 Member Nguyễn Thu Vân K194060880 Member download by : skknchat@gmail.com TABLE OF CONTENTS ABSTRACT CHAPTER I: OVERVIEW OF THE TOPIC I WHY CHOOSING THIS SUBJECT? II PROJECT OBJECTIVES III EXPECTED RESULTS IV PRACTICAL SIGNIFICANCE For users For my team CHAPTER II: INTRODUCTION I MODEL PARTICIPANT II GENERAL DESCRIPTION OF THE COMPANY III GENERAL BUSINESS PROCESS Import process Sales process IV MAIN FUNCTION OF THE BUSINESS MODEL Import process Sales process 10 V MAIN FUNCTION OF APP 12 CHAPTER III: ENTITY RELATIONSHIP DIAGRAM 14 I IDENTIFIES ENTITIES AND ATTRIBUTES 14 II RELATIONSHIP OF ENTITIES 17 III ENTITY RELATIONSHIP DIAGRAM (ERD) 21 CHAPTER IV: LOGICAL DATABASE MODEL 23 CHAPTER V: PHYSICAL DATABASE MODEL 24 I DATA TYPES 24 II DATABASE CREATION STATEMENT 35 Command to create database 35 Create a foreign key 83 CHAPTER VI: SQL QUERY 85 download by : skknchat@gmail.com ABSTRACT The demand of manage information is highly in every organization Management information effectively help reduce cost, time and avoid redundancy data To understand deeply how benefit a database can bring to an organization and the process to build a database, we decided to build a Market Online Management Project With the aim to help clinics easily in managing their business, take care of customers, … We know within building this project, there will be mistakes that we can solve but it is the chance for us to achieve knowledge and skills which are precious tools in the future and we will make this project as good as we can download by : skknchat@gmail.com CHAPTER I: OVERVIEW OF THE TOPIC I WHY CHOOSING THIS SUBJECT? In the past, most of us would buy food mainly from wholesale markets, buying agents in big centers or in markets and department stores Today, the development of the digital economy has changed the business perception of the whole society It can be seen that all products and services can be introduced and "sold" on the Internet Moreover, customers increasingly need to know information about the origin and origin of agricultural products that ensure quality and safety for health or not? Therefore, in addition to improving food quality, brand communication, and packaging improvement to affirm quality reputation, managers need a more effective communication channel and app design is the ultimate solution selected best Owning a sales app will help businesses attract more potential customers through the internet According to the latest statistics, Vietnam currently has about 41 million internet users, accounting for about 45% of the country's population, most of which are young people with high shopping needs Moreover, nowadays, the online trend is developing day by day and is buying by many users About one third of the population uses the internet to search and look up information about services and products Therefore, when you have a sales app, your business has attracted a number of customers on the internet Without the app, you would have lost an opportunity to sell and give that opportunity to competitors II PROJECT OBJECTIVES Promote sales activities anytime, anywhere Customers will not have to come directly to the store or purchase according to the store's operating hours but can buy at any time This helps to maximize sales opportunities, boost sales and facilitate customers to shop, making them more satisfied Reduce business costs Having a sales app will help save a lot of costs for store rental, warehouse and human resource costs In addition, having a sales app also makes the payment of customers convenient and easier Customers can pay via ATM cards, through electronic payment methods download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project Having a separate sales app for the business will also help improve the reputation and brand value of the business The face of a business on the internet is the app and the colors, features and information on the app will fully reflect the image of the business with the customer, contributing to affirm the company's brand value in the hearts of the public III EXPECTED RESULTS Design database for the application of ordering products through the app Build management and business processes for the app model IV PRACTICAL SIGNIFICANCE For users When the software was built, it became easier for the housewives to shop and cook Specifically, through each form of software including customer management, food import and export management (export here means providing food to customers) Thanks to that, the manager can comprehensively monitor the data and use it properly, thereby helping the usage process and supporting decision making in the best way For my team Understanding the process of building a database from idea creation, modeling, data collection, storage and operation on SQL Designing a software based on the available data Project is the basis that my group can continue to develop in the following subjects project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project CHAPTER II: INTRODUCTION I MODEL PARTICIPANT Suppliers Customers Shipping unit Bank Employee II GENERAL DESCRIPTION OF THE COMPANY APP acts as an intermediary to help seller's products reach consumers conveniently and quickly on the website In order to provide clean food to consumers quickly and conveniently, APP has main departments including Sales and Marketing, and Accounting Division IT department and warehouse management department III GENERAL BUSINESS PROCESS Import process project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project Procedure Describe Step Plan and contract with supplier Step Check the goods and compare Step Make an inventory receipt Step Completion of warehousing and payment Sales process Procedure Describe Step Customer order Step Order process Step Payment process Step Delivery and processing of returned orders IV MAIN FUNCTION OF THE BUSINESS MODEL Import process project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project - Plan and contract with supplier Staff sends purchase request information to Seller including: real name, product, quantity to be purchased, delivery schedule project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project The import department contact with the Supplier and notify the plan to the relevant to update information and sign a purchase contract Then, the contract information will be saved And in the Contract database, each contract will be managed with a contract code individual - Check the goods and compare The warehouse department keeper relies on the purchase order or request form to compare inventory information from the Warehouse database and at the same time check their quality - Make an inventory receipt When the goods inspection is completed, all paperwork and receipt request will be transferred to the accounting department to compare again before conducting the transaction and printing the receipt Information about the goods entering the warehouse and the receipt will be saved in the Warehouse database to manage imported products - Completion of warehousing and payment The department store keeper performs the stock storage operation and collates with the sales information, then updates the information on the warehouse card Finally, payment is made to the provider When the payment is successful, invoice information will be recorded on the basis Corporate Purchase Invoice data Sales process project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project CREATE TABLE RETURNED_GOODS_DELIVERY_NOTE ( RETURN_NOTE_ID CHAR(6) NOT NULL, RETURN_TIME DATETIME NOT NULL, DELIVERY_NOTE_ID CHAR(8) NOT NULL, CUSTOMER_ID CHAR(8) NOT NULL, CONSTRAINT PK_RETURNED_GOODS_DELIVERY_NOTE PRIMARY KEY (RETURN_TIME, RETURN_NOTE_ID) ) GO CREATE NONCLUSTERED INDEX R25_FK ON RETURNED_GOODS_DELIVERY_NOTE (RETURN_TIME ASC, RETURN_NOTE_ID ASC) GO CREATE TABLE RETURNED_GOODS_DELIVERY_NOTE_DETAIL ( RETURN_NOTE_ID CHAR(6) NOT NULL, RETURN_TIME DATETIME NOT NULL, LINE_NUMBER INT NOT NULL, DELIVERY_NOTE_ID CHAR(8) NOT NULL, PRODUCT_ID CHAR(8) NOT NULL, QUANTITYNUMERIC(7,2) NOT NULL, UNIT_PRICE NUMERIC(10,2) NOT NULL, project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project TOTAL_AMOUNT NUMERIC(10,2) NOT NULL, REASON VARCHAR(50) NOT NULL, CONSTRAINT PK_RETURNED_GOODS_DELIVERY_NOTE_DETAIL PRIMARY KEY (RETURN_TIME, RETURN_NOTE_ID, LINE_NUMBER) ) GO CREATE NONCLUSTERED INDEX R26_FK ON RETURNED_GOODS_DELIVERY_NOTE_DETAIL (RETURN_TIME ASC, RETURN_NOTE_ID ASC, DELIVERY_NOTE_ID ASC) GO ALTER TABLE CONTRACT ADD CONSTRAINT FK_CONTRACT_R1_ SUPPLIER FOREIGN KEY (SUPPLIER_ID) REFERENCES SUPPLIER (SUPPLIER_ID) GO ALTER TABLE CONTRACT_DETAIL ADD CONSTRAINT FK_CONTRACT_DETAIL_R2_CONTRACT FOREIGN KEY (CONTRACT_TIME, CONTRACT_ID) REFERENCES CONTRACT (CONTRACT_TIME, CONTRACT_ID, LINE_NUMBER) GO project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project ALTER TABLE GOODS_RECEIPT_NOTE ADD CONSTRAINT FK_ GOODS_ RECEIPT_NOTE_R3_SUPPLIER FOREIGN KEY (SUPPLIER_ID) REFERENCES SUPPLIER (SUPPLIER_ID) GO ALTER TABLE GOODS_ RECEIPT_NOTE_DETAIL ADD CONSTRAINT FK_ GOODS_ RECEIPT_NOTE_DETAIL _R4_ GOODS_ RECEIPT _NOTE FOREIGN KEY (RECEIPT_TIME, RECEIPT_NOTE_ID) REFERENCES GOODS_ RECEIP _NOTE (RECEIPT_TIME, RECEIPT_NOTE_ID, LINE_NUMBER) GO ALTER TABLE EMPLOYEE ADD CONSTRAINT FK_ EMPLOYEE _R5_ DEPARTMENT FOREIGN KEY (ATTRIBUTE_14) REFERENCES DEPARTMENT(ATTRIBUTE_14) GO ALTER TABLE MANAGER ADD CONSTRAINT FK_ MANAGER_INHERITAN_ EMPLOYEE FOREIGN KEY (EMPLOYEE_ID) REFERENCES EMPLOYEE (EMPLOYEE_ID) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project GO ALTER TABLE EMPLOYEE_ONL ADD CONSTRAINT FK_EMPLOYEE_ONL_INHERITAN_ EMPLOYEE FOREIGN KEY (EMPLOYEE_ID) REFERENCES EMPLOYEE (EMPLOYEE_ID) GO ALTER TABLE EMPLOYEE_ONL ADD CONSTRAINT FK_EMPLOYEE_ONL_R6_MANAGER FOREIGN KEY (MANAGER_ID) REFERENCES MANAGER(MANAGER_ID) GO ALTER TABLE EMPLOYEE_OFF ADD CONSTRAINT FK_EMPLOYEE_OFF_INHERITAN_ EMPLOYEE FOREIGN KEY (EMPLOYEE_ID) REFERENCES EMPLOYEE (EMPLOYEE_ID) GO ALTER TABLE EMPLOYEE_OFF ADD CONSTRAINT FK_EMPLOYEE_OFF_R7_MANAGER FOREIGN KEY (MANAGER_ID) REFERENCES MANAGER(MANAGER_ID) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project GO ALTER TABLE GOODS_DELIVERY_NOTE ADD CONSTRAINT FK_ GOODS_DELIVERY_NOTE _R8_EMPLOYEE_OFF FOREIGN KEY (EMPLOYEE_OFF_ID) REFERENCES EMPLOYEE_OFF(EMPLOYEE_OFF_ID) GO ALTER TABLE GOODS_RECEIPT_NOTE_DETAIL ADD CONSTRAINT FK_ GOODS_ RECEIPT_NOTE_DETAIL _R9_ WAREHOUSE_ID FOREIGN KEY (WAREHOUSE_ID) REFERENCES WAREHOUSE_LIST (WAREHOUSE_ID) GO ALTER TABLE PRODUCT ADD CONSTRAINT FK_PRODUCT_R10_CONTRACT_DETAIL FOREIGN KEY (CONTRACT_TIME, CONTRACT_ID, LINE_NUMBER) REFERENCES CONTRACT_DETAIL (CONTRACT_TIME, CONTRACT_ID, LINE_NUMBER) GO ALTER TABLE WAREHOUSE_LIST ADD CONSTRAINT FK_ WAREHOUSE_LIST _R11_ INVENTORY_LIST FOREIGN KEY (PRODUCT_ID) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project REFERENCES INVENTORY_LIST (PRODUCT_ID) GO ALTER TABLE PRODUCT ADD CONSTRAINT FK_PRODUCT_R12_INVENTORY_LIST FOREIGN KEY (PRODUCT_ID) REFERENCES INVENTORY_LIST (PRODUCT_ID) GO ALTER TABLE ORDER ADD CONSTRAINT FK_ORDER_R13_CUSTOMER FOREIGN KEY (CUSTOMER_ID) REFERENCES CUSTOMER (CUSTOMER_ID) GO ALTER TABLE ORDER_DETAIL ADD CONSTRAINT FK_ORDER_DETAIL_R14_ORDER FOREIGN KEY (ORDER_TIME, ORDER_ID) REFERENCES ORDER (ORDER_TIME, ORDER_ID) GO ALTER TABLE ORDER ADD CONSTRAINT FK_ORDER_R15_INVOICE FOREIGN KEY (ORDER_TIME, ORDER_ID) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project REFERENCES INVOICE (INVOICE_TIME, INVOICE_ID) GO ALTER TABLE INVOICE_DETAIL ADD CONSTRAINT FK_INVOICE_DETAIL_R16_INVOICE FOREIGN KEY (INVOICE_TIME, INVOICE_ID) REFERENCES INVOICE (INVOICE_TIME, INVOICE_ID) GO ALTER TABLE GOODS_DELIVERY_NOTE_DETAIL ADD CONSTRAINT FK_CT_PHIEU_R17_CT_HOA_D FOREIGN KEY (DELIVERY_TIME, DELIVERY_ID, LINE_NUMBER) REFERENCES INVOICE_DETAIL (INVOICE_TIME, INVOICE_ID, LINE_NUMBER) GO ALTER TABLE GOODS_DELIVERY_NOTE_DETAIL ADD CONSTRAINT FK_CT_PHIEU_R18_PHIEU_XU FOREIGN KEY (DELIVERY_TIME, DELIVERY_NOTE_ID) REFERENCES GOODS_DELIVERY_NOTE (DELIVERY_TIME, DELIVERY_NOTE_ID) GO ALTER TABLE GOODS_DELIVERY_NOTE project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project ADD CONSTRAINT FK_GOODS_DELIVERY_NOTE_R19_ DELIVERY_COMPANY FOREIGN KEY (DELIVERY_COMPANY _ID) REFERENCES DELIVERY_COMPANY (DELIVERY_COMPANY_ID) GO ALTER TABLE DELIVERY_STATUS ADD CONSTRAINT FK_ DELIVERY_STATUS_R20_ DELIVERY_COMPANY FOREIGN KEY (DELIVERY_COMPANY_ID) REFERENCES DELIVERY_COMPANY (DELIVERY_COMPANY_ID) GO ALTER TABLE INVOICE ADD CONSTRAINT FK_INVOICE_R21_CUSTOMER FOREIGN KEY (CUSTOMER_ID) REFERENCES CUSTOMER (CUSTOMER_ID) GO ALTER TABLE RETURNED_GOODS_DELIVERY_NOTE ADD CONSTRAINT FK_RETURNED_GOODS_DELIVERY_NOTE _R22_GOODS_DELIVERY_NOTE FOREIGN KEY (RETURN_TIME, RETURN_ID, DELIVERY_ID) REFERENCES GOODS_DELIVERY_NOTE (DELIVERY_TIME, RETURN_ID, DELIVERY_ID) GO project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project ALTER TABLE RETURNED_GOODS_DELIVERY_NOTE_DETAIL ADD CONSTRAINT FK_RETURNED_GOODS_DELIVERY_NOTE_DETAIL_R23_ RETURNED_GOODS_DELIVERY_NOTE FOREIGN KEY (RETURN_TIME, RETURN_NOTE_ID, DELIVERY_NOTE_ID) REFERENCES RETURNED_GOODS_DELIVERY_NOTE (RETURN_TIME, RETURN_NOTE_ID, LINE_NUMBER) GO ALTER TABLE RETURNED_GOODS_DELIVERY_NOTE_DETAIL ADD CONSTRAINT FK_ RETURNED_GOODS_DELIVERY_NOTE_DETAIL _R24_ INVENTORY_LIST FOREIGN KEY (PRODUCT_ID) REFERENCES INVENTORY_LIST (PRODUCT_ID) GO Create a foreign key ALTER TABLE NHANVIEN ADD CONSTRAINT FK_NHANVIEN_MAPB FOREIGN KEY (MaPB) REFERENCES PHONGBAN ALTER TABLE HOPDONG ADD CONSTRAINT FK_HOPDONG_MANCC FOREIGN KEY (MANCC) REFERENCES NHACUNGCAP (MANCC) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project ALTER TABLE PHIEUNHAP ADD CONSTRAINT FK_PHIEUNHAP_MANCC FOREIGN KEY (MANCC) REFERENCES NHACUNGCAP (MANCC) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project CHAPTER VI: SQL QUERY Q1: Display information of customers whose first letter is the letter a SELECT FIRST_NAME, LAST_NAME FROM CUSTOMER WHERE FIRST_NAME LIKE 'a%' Q2: Display customer information, invoice code, order number of customers who buy the product "Fried Combo 1" SELECT cus.CUSTOMER_ID, cus.CUSTOMER_NAME, cus.ADDRESS, cus.PHO NE, inv.INVOICE_ID, invd.INVOICE_ID, pro.PRODUCT_NAME FROM CUSTOMER cus JOIN INVOICE inv ON cus.MaKH=hod.MaKH JOIN INVOICE_DETAIL invd ON inv.INVOICE_TIME=invd.INVOICE_TIME and inv.INVOICE_ID =invd.INVOICE_ID JOIN PRODUCT pro ON invd.PRODUCT_ID=pro PRODUCT_ID WHERE PRODUCT_NAME like N'% Fried Combo 1%' Q3: Display customer code with orders in January 2021 SELECT cus.CUSTOMER_ID,ord.ORDER_TIME FROM CUSTOMER cus JOIN ORDER ord ON cus.CUSTOMER_ID=ord.CUSTOMER_ID project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project WHERE LEFT(ORDER_TIME,7)='2021-01' Q4: Display products with more than times the number of returns SELECT PRODUCT_ID, PRODUCT_NAME, (SELECT COUNT(PRODUCT_ID) FROM RETURNED_GOODS_DELIVERY_NOTE_DETAIL redd WHERE pro.PRODUCT_ID = redd.PRODUCT_ID) AS ' Number of returns' FROM PRODUCT pro Q5: Display information of the department have more than employees SELECT emp.department_id, dep.department_name, COUNT(*) AS "Employees" FROM employee as emp JOIN department as dep ON dep.department_id=emp.department_id GROUP BY emp.department_id, dep.department_id HAVING COUNT(*)>8 Q6: Display information of employee who has the highest salary for each department SELECT emp.department_id , emp.employee_id, MAX(emp.Salary) AS "Highest salary" FROM employee emp JOIN department dep ON dep.department_id = emp.department_id GROUP BY emp.department_id , emp.employee_id Q7: Display product_id and product_name which are not sold in March, 2021 SELECT DISTINCT product_id, product_name project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project FROM product, goods_delivery_note WHERE product_is NOT IN (SELECT DISTINCT a.product_id FROM goods_delivery_note_detail as a JOIN goods_delivery_note as b ON a.id=b.id WHERE b.date LIKE '2021-07' or b.date> '2021-07' and b.date (SELECT AVG(a.SALARY) project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project FROM EMPLOYEES a) order by e.SALARY desc Q11: Minimum number of sales of each type of product in all sales SELECT od.PRODUCT_ID,pro.PRODUCT_NAME, MIN(od.SL) AS "Minimum quantity sold " FROM ORDERDETAIL od JOIN PRODUCT pro On od.PRODUCT_ID=pro.PRODUCT_ID GROUP BY od.PRODUCT_ID, pro.PRODUCT_NAME Q12: Displays contract code, coupon period, vendor code, supplier name that offers contract value not between 34500000 and 550000000 SELECT C.TIME,C.CONTRACT_ID,C.SUPPLIER_ID,S.SUPLLIER_NAME,cd.VALUE FROM CONTRACT C JOIN SUPPLIER S ON C.SUPPLIER_ID=S.SUPPLIER_ID JOIN CONTRACTDETAIL cd ON C.MaHopDong=S.MaHopDong AND C.TIME=cd.TIME WHERE VALUE not between 34500000 and 550000000 Q13: For each product, know the product code, product name and number of sales FROM KHACHHANG KH project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project download by : skknchat@gmail.com project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project project.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.projectproject.report.subject.databases.subject.name.market.online.management.project

Ngày đăng: 08/01/2024, 01:10

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan