Wale Part II (1)

download Wale Part II (1)

of 23

Transcript of Wale Part II (1)

  • 8/2/2019 Wale Part II (1)

    1/23

    Assignment title

    1. ENTITY IDENTIFICATION

    Table No. Entity Attribute Data type

    1. Employee employeeID

    employeeName

    username

    userPassword

    employeeRole

    dateCreated

    Int

    varchar

    varchar

    varchar

    varchar

    datetime

    2. antiqueCategory categoryID

    categoryTitle

    dateAdded

    employeeID

    Int

    varchar

    datetime

    int

    3. products productID

    antiqueTItle

    categoryID

    collector

    staffID

    antiqueStatus

    dateAdded

    int

    varchar

    int

    varchar

    int

    varchar

    datetime

    4. purchase transactionID

    antiqueTitle

    categoryID

    amountPurchased

    seller

    int

    varchar

    int

    varchar

    varchar

    1 Student name

  • 8/2/2019 Wale Part II (1)

    2/23

    Assignment title

    staffID

    transactionDate

    int

    datetime

    5. repairEquipment repairID

    equipmentTitle

    int

    varchar

    6. repairs repairID

    productID

    repairDescription

    collector

    assignedBy

    assignedTo

    repairStatus

    dateAdded

    int

    int

    varchar

    varchar

    varchar

    varchar

    varchar

    7. sales entryID

    productID

    amountSold

    staffID

    buyerInfomation

    transactionDate

    int

    int

    varchar

    int

    varchar

    datetime

    2. ER DIAGRAM USING UML NOTATION

    2 Student name

  • 8/2/2019 Wale Part II (1)

    3/23

    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

  • 8/2/2019 Wale Part II (1)

    4/23

    Assignment title

    purchase(transactionID,antiqueTitle,categoryID,amountPurchased,seller,employeeName,

    employeeRole,transactionDate)

    Above we have a Purchase table with transactionID, employeeName,and employeeRole andfrom 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

    4 Student name

  • 8/2/2019 Wale Part II (1)

    5/23

    Assignment title

    5. LOGICAL ER MODEL

    Table No. Entity Attribute Data type Length Constraint

    5 Student name

  • 8/2/2019 Wale Part II (1)

    6/23

    Assignment title

    1. Employee employeeID

    employeeName

    username

    userPassword

    employeeRole

    dateCreated

    Int

    varchar

    varchar

    varchar

    varchar

    datetime

    100

    50

    50

    50

    50

    Primary key

    2. antiqueCategory categoryID

    categoryTitle

    dateAdded

    employmentID

    Int

    varchar

    datetime

    int

    50

    Primary key

    Foreign key

    3. products productID

    antiqueTItle

    categoryID

    collector

    staffID

    antiqueStatus

    dateAdded

    int

    varchar

    int

    varchar

    int

    varchar

    datetime

    50

    80

    80

    Primary key

    4. purchase transactionID

    antiqueTitle

    categoryID

    amountPurchased

    seller

    staffID

    int

    varchar

    int

    varchar

    varchar

    int

    50

    20

    80

    Primary key

    Foreign key

    Foreign key

    6 Student name

  • 8/2/2019 Wale Part II (1)

    7/23

    Assignment title

    transactionDate datetime

    5. repairEquipment repairID

    equipmentTitle

    int

    varchar 50

    Foreign key

    6. repairs repairID

    productID

    repairDescription

    collector

    assignedBy

    assignedTo

    repairStatus

    dateAdded

    int

    int

    varchar

    varchar

    varchar

    varchar

    varchar

    200

    80

    10

    10

    10

    Primary key

    Foreign key

    7. sales entryID

    productID

    amountSold

    staffID

    buyerInfomation

    transactionDate

    int

    int

    varchar

    int

    varchar

    datetime

    50

    250

    Primary key

    Foreign key

    Foreign key

    6. QUERIES AND DATABASE EXECUTION

    6.1.SQL statements

    CREATEDATABASE antique

    GO

    7 Student name

  • 8/2/2019 Wale Part II (1)

    8/23

    Assignment title

    CREATETABLE employee

    (

    employeeID intIDENTITY(1,1)PRIMARYKEY,

    employeeName varchar(100),

    username varchar(50),

    userPassword varchar(50),

    employeeRole varchar(50),

    dateCreated datetime

    )

    CREATETABLE purchase

    (

    transactionID intIDENTITY(1,1)PRIMARYKEY,

    antiqueTitle varchar(50),

    categoryID int,

    amountPurchased varchar(20),

    seller varchar(80),

    employeeID int,

    transactionDate datetime

    )

    CREATETABLE products

    (

    productID intIDENTITY(1,1)PRIMARYKEY,

    antiqueTitle varchar(50),

    categoryID int,

    collector varchar(80),

    8 Student name

  • 8/2/2019 Wale Part II (1)

    9/23

    Assignment title

    employeeID int,

    antiqueStatus varchar(80),

    dateAdded datetime

    )

    CREATETABLE repairs

    (

    repairID intIDENTITY(1,1)PRIMARYKEY,

    productID int,

    repairDescription varchar(200),

    collector varchar(80),

    assignedBy varchar(10),

    assignedTo varchar(10),

    repairStatus varchar(10),

    dateAdded datetime

    )

    CREATETABLE antiqueCategory

    (

    categoryID intIDENTITY(1,1)PRIMARYKEY,

    categoryTitle varchar(50),

    employeeID int,

    dateAdded datetime

    )

    CREATETABLE repairEquipment

    (

    repairID int,

    equipmentTitle varchar(50)

    9 Student name

  • 8/2/2019 Wale Part II (1)

    10/23

    Assignment title

    )

    CREATETABLE sales

    (

    entryID intIDENTITY(1,1)PRIMARYKEY,

    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

  • 8/2/2019 Wale Part II (1)

    11/23

    Assignment title

    This query creates the product and repair table.

    11 Student name

  • 8/2/2019 Wale Part II (1)

    12/23

    Assignment title

    The query below creates the antiqueCategory table.

    12 Student name

  • 8/2/2019 Wale Part II (1)

    13/23

    Assignment title

    The query below create sale sales table.

    13 Student name

  • 8/2/2019 Wale Part II (1)

    14/23

    Assignment title

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

    14 Student name

  • 8/2/2019 Wale Part II (1)

    15/23

    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

  • 8/2/2019 Wale Part II (1)

    16/23

    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 roleadmin 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 andthose 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

  • 8/2/2019 Wale Part II (1)

    17/23

    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

  • 8/2/2019 Wale Part II (1)

    18/23

    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

  • 8/2/2019 Wale Part II (1)

    19/23

    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

  • 8/2/2019 Wale Part II (1)

    20/23

    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

  • 8/2/2019 Wale Part II (1)

    21/23

    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

  • 8/2/2019 Wale Part II (1)

    22/23

    Assignment title

    22 Student name

  • 8/2/2019 Wale Part II (1)

    23/23

    Assignment title

    23 Student name