You are on page 1of 23

Assignment title 1. ENTITY IDENTIFICATION Table No. 1.

Entity Employee Attribute employeeID employeeName username userPassword employeeRole dateCreated 2. antiqueCategory categoryID categoryTitle dateAdded employeeID 3. products productID antiqueTItle categoryID collector staffID antiqueStatus dateAdded 4. purchase transactionID antiqueTitle categoryID amountPurchased seller Data type Int varchar varchar varchar varchar datetime Int varchar datetime int int varchar int varchar int varchar datetime int varchar int varchar varchar

Student name

Assignment title staffID transactionDate 5. repairEquipment repairID equipmentTitle 6. repairs repairID productID repairDescription collector assignedBy assignedTo repairStatus dateAdded 7. sales entryID productID amountSold staffID buyerInfomation transactionDate int int varchar int varchar datetime int datetime int varchar int int varchar varchar varchar varchar varchar

2. ER DIAGRAM USING UML NOTATION

Student name

Assignment title

ER model with only the primary and secondary keys.

3. 3rd Normal Form is A table whose non-primary key fields are dependent only on the primary key and therefore have no dependence (relationship to) any other non-primary key field in the table is consider in third normal form (3NF).
3 Student name

Assignment title

purchase(transactionID,antiqueTitle,categoryID,amountPurchased,seller,employeeName, employeeRole,transactionDate) Above we have a Purchase table with transactionID, employeeName,and employeeRole and from these, the employeeRole is dependent upon the employeeName and the purchase primary key for this table transactionID. To change this table to third normal form we need to break out the employeeName and employeeRole fields into a separate table. There resulting 3rd Normal Form purchase(transactionID,antiqueTitle,categoryID,amountPurchased,seller,employeeID,tra nsactionDate) employee(employeeID,employeeName,username,userPassword,employeeRole)

sales(entryID,antiqueTitle,antiqueStatus,amountSold,employeeName,username,userPassw ord,employeeRole,buyerInfomation,transactionDate) The above sales table with entryID, employeeName, and employeeRole and from these, the employeeRole is dependent upon the employeeName and the sales primary key for this table entryID. To change this table to third normal form we need to break out the employeeName and employeeRole fields into a separate table and the resulting 3rd Normal Form sales(entryID,antiqueTitle,antiqueStatus,amountSold,employeeID,buyerInfomation,transa ctionDate) employee(employeeID,employeeName,username,userPassword,employeeRole)

4. ER DIAGRAM WITH ER MODELING NOTATIONS

Student name

Assignment title

5. LOGICAL ER MODEL Table No.


5

Entity
Student name

Attribute

Data type

Length

Constraint

Assignment title

1.

Employee

employeeID employeeName username userPassword employeeRole dateCreated

Int varchar varchar varchar varchar datetime Int varchar datetime int int varchar int varchar int varchar datetime int varchar int varchar varchar int

100 50 50 50 50

Primary key

2.

antiqueCategory

categoryID categoryTitle dateAdded employmentID

Primary key 50

Foreign key Primary key 50

3.

products

productID antiqueTItle categoryID collector staffID antiqueStatus dateAdded

80

80

4.

purchase

transactionID antiqueTitle categoryID amountPurchased seller staffID

Primary key 50 Foreign key 20 80 Foreign key

Student name

Assignment title transactionDate 5. repairEquipment repairID equipmentTitle 6. repairs repairID productID repairDescription collector assignedBy assignedTo repairStatus dateAdded 7. sales entryID productID amountSold staffID buyerInfomation transactionDate int int varchar int varchar datetime 250 50 Foreign key Primary key Foreign key datetime int varchar int int varchar varchar varchar varchar varchar 200 80 10 10 10 50 Primary key Foreign key Foreign key

6. QUERIES AND DATABASE EXECUTION 6.1.SQL statements


CREATE DATABASE antique GO

Student name

Assignment title

CREATE TABLE employee ( employeeID int IDENTITY (1,1) PRIMARY KEY, employeeName varchar (100), username varchar (50), userPassword varchar (50), employeeRole varchar (50), dateCreated datetime )

CREATE TABLE purchase ( transactionID int IDENTITY (1,1) PRIMARY KEY, antiqueTitle varchar (50), categoryID int, amountPurchased varchar (20), seller varchar (80), employeeID int, transactionDate datetime )

CREATE TABLE products ( productID int IDENTITY (1,1) PRIMARY KEY, antiqueTitle varchar (50), categoryID int, collector varchar (80),

Student name

Assignment title
employeeID int, antiqueStatus varchar (80), dateAdded datetime )

CREATE TABLE repairs ( repairID int IDENTITY (1,1) PRIMARY KEY, productID int, repairDescription varchar (200), collector varchar (80), assignedBy varchar (10), assignedTo varchar (10), repairStatus varchar (10), dateAdded datetime )

CREATE TABLE antiqueCategory ( categoryID int IDENTITY (1,1) PRIMARY KEY, categoryTitle varchar (50), employeeID int, dateAdded datetime ) CREATE TABLE repairEquipment ( repairID int, equipmentTitle varchar (50)

Student name

Assignment title
)

CREATE TABLE sales ( entryID int IDENTITY (1,1) PRIMARY KEY, productID int, amountSold varchar (50), employeeID int, buyerInfomation varchar (250), transactionDate datetime )

6.2.Populated table The query below creates the employee and purchase table.

10

Student name

Assignment title

This query creates the product and repair table.

11

Student name

Assignment title

The query below creates the antiqueCategory table.

12

Student name

Assignment title

The query below create sale sales table.

13

Student name

Assignment title

The screen below shows all the tables that were previously created.

14

Student name

Assignment title

7. The proposed inventory management system is a crucial component in every antique store in

the sense that it serves both internal and external purposes. Antique theft is a common event in our society today. The proposed system will not only serve as a medium which will be used for
15 Student name

Assignment title data storage and inventory management but could also aid in police investigation and recovery of stolen antiques since the proposed system has the capability to store all antiques brought to the company. He proposed system will keep detailed description of the repair made on each antique which could be used compare against the damage on the stolen antique. The proposed inventory management system database will comprise of seven (7) tables with will be used to store every transaction carried out within the system.
1. antiqueCategory table: will contain all categories of antiques sold or repaired by the

company. This table will also accept input of new categories.


2. employee table: this table stores the detail of all employee(s) who have access to the

system. The role acts a security mechanism which will be used to restrict user access. The system will use the employee role to determine which resource will be made available and the operation the users will have allowed to perform. For instance role expert will not be allowed to create new category or perform a transaction while role admin will not have access to update repair status on the repair table.
3. products table: the table will be used for antique management. It will contain a list of

all the antiques which the company have managed either for purchased or was brought for repairs. It will give the company the ability to reviews all the antiques that they have encountered over the years and could be sort by their status wither in stock (indicates that the product is still available in the store), sold(indicates that the product has been sold to another collected) or have been returned after refurbishment(indicates thats the product was brought for repair and has been returned to the owner).
4. purchase table: this table stores detail of all the antiques purchased by the company

with relevant information such as the sellers name, date of purchase, amount purchased and the staff who performed the transaction. This table gives the company the ability to review all transactions based on the initiator which will also act as a security mechanism for prior fraud investigation within the company.
5. repairEquipment table: this stores all the equipments used for the refurbishment of

particular antique. This table will enable the company keep track of how antiques were refurbished and will be useful for future reference. This table also acts as an equipment inventory tool which will be used to take stock of equipment that has been used and those with ought to be in the company equipment stores.
6. repairs table stores detail of all the antiques that has been refurbishment by the

company. The table contains information such as the owner of the antique, the product identification as stored in the product table and the name of the expert who performed the refurbishment.
16 Student name

Assignment title
7. sales table stored the detail of all out going transaction (sale of antiques) which were

carried out by the company along with relevant information such as price sold, to whom it was sold and the date of transaction.

The query below illustrates a concept with is similar to join function in sql Query. This feature gives a programmer the capability to select from multiple tables at the same time with a single query. The query below selects the productID from table products and table sales where the productID are the same.

17

Student name

Assignment title

The query below and the query above are somewhat similar but was tweaked to perform a more complex function. The query below selects all products from product table and repair table where the repairStatus is progress.

18

Student name

Assignment title

The query below selects all the employees whose role is experts. This query will be used to display the detail of all the experts in the system.

19

Student name

Assignment title

The query below uses the count function which is a predefined class (key word or function) in mysql, MS Server e.t.c. The concept is used for user authentication where by the username and password are compared with those in the database and if a match is found the

20

Student name

Assignment title output will be counted, if it is than one(1) an error message is mostly displayed else the user will be logged into the system.

21

Student name

Assignment title

22

Student name

Assignment title

23

Student name

You might also like