henry(database design & implementation)

Upload: chinedu-iroanyah

Post on 07-Apr-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Henry(Database Design & Implementation)

    1/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    1

    Table of Contents

    1.0 INTRODUCTION ............................................................................................................................ 2

    2.0 PART ONE ....................................................................................................................................... 2

    2.1 First Site ........................................................................................................................................ 2

    2.2 Second Site.................................................................................................................................. 11

    2.3 Third Site .................................................................................................................................... 19

    2.4 Conclusion .................................................................................................................................. 26

    2.4.1 Generic List.......................................................................................................................... 27

    2.4.2 Added Attributes .................................................................................................................. 28

    3.0 NORMALIZATION ....................................................................................................................... 29

    4.0 ERD ................................................................................................................................................ 32

    5.0 EER DIAGRAM ............................................................................................................................. 33

    6.0 DATA SCHEMA............................................................................................................................ 34

    7.0 TABLE SCHEMA .......................................................................................................................... 35

    8.0 PART 4 ........................................................................................................................................... 37

    9.0 QUERIES........................................................................................................................................ 42

    10.0 CONCLUSION............................................................................................................................. 46

    11.0 REFERENCES ............................................................................................................................. 47

  • 8/3/2019 Henry(Database Design & Implementation)

    2/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    2

    1.0 INTRODUCTION

    This documentation is based on the creation of a commercial database using mysql by analysing three

    different websites and also creating a database based on the data entry fields identified from the three

    websites. This documentation also covers the running of five queries for the created database.

    2.0 PART ONE

    2.1 First Site

    The first site that was used for this documentation iswww.360degree.com.my.

    HOME PAGE

    when a prospective purchaser visits www.360degree.com .my to shop, the first step to take will be to

    click on the products tab from where the categoriesof products will be diplayed:

    http://www.360degree.com.my/http://www.360degree.com.my/http://www.360degree.com.my/http://www.360degree.com.my/
  • 8/3/2019 Henry(Database Design & Implementation)

    3/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    3

    Here the prospective shopper is presented with options to choose from different categories:

    The available major categories with their sub-categories are:

    This is the

    products

    tab

  • 8/3/2019 Henry(Database Design & Implementation)

    4/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    4

    MAIN CATEGORY SUB-CATEGORY

    Accessory Belt

    Cufflinks

    Handbag

    Jewelry - Bracelet

    jewelry - Earrings

    jewelry - Necklace

    jewelry - Ring

    jewelry Sets

    Dress Everyday Dress

    Occasion Dress

    Shirt/Blouse Plain Blouse

    Plain Shirt

    Prints Blouse

    Prints Shirt

    Shoes Flats

    High Heel

    PumpsSkirt Short Length Skirt

    T-shirt/Top Jackets

    Long Sleeve Top

    Short Sleeve T-shirt

    Short Sleeve Top

    Vests & Camisoles

    Trousers Casual Trousers

    Jeans

    Leggings

    Shorts

    The proceed with the shopping the purchaser has to select a sub-category. For the purpose of this

    documentation the belt subcategory was selected and this displays images of the items available for

    the sub category with their prices from which the Micro Mini Stud Belt was selected for the purpose

    of this documentation:

  • 8/3/2019 Henry(Database Design & Implementation)

    5/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    5

    On selection the item takes the items details page that displays the item with more information about

    its available options which includes its product code, unit price, the options to select a colour, a size,

    and the quantity needed after which the purchaser is to click on the shopping cart icon with an

    available tag above it to add the selected product to his shopping cart and move to the next page:

    This shows the contents of the shopping cart which includes:

    Item Number

    Code

    Item Name

    Unit price

  • 8/3/2019 Henry(Database Design & Implementation)

    6/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    6

    Quantity

    Total price

    And the purchaser is provided with the option of continuing with the shopping or proceeds to

    checkout. The proceed to check out is selected for the purpose of this documentation

    The next thing is that the purchaser is asked to either sign in as a returning customer or sign up as a

    new customer to continue with the checkout. And for the purpose of this documentation, the sign up

    option is chosen:

  • 8/3/2019 Henry(Database Design & Implementation)

    7/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    7

    On selecting the sign up option the new customer is presented with a registration form requiring the

    following information:

  • 8/3/2019 Henry(Database Design & Implementation)

    8/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    8

    The new customer must complete the following fields to sign up:

    Login Name:

    Password:

    Password Confirmation:

    Full Name:

    Address:

    Postcode:

    State:

    I/C No. :

    Date of Birth (DD/MM/YYYY):

    Contact No. (+601XXXXXXXX):

    Email 1 (Primary):

  • 8/3/2019 Henry(Database Design & Implementation)

    9/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    9

    On filling in the required information a confirmation e-mail is sent to the new users e-mail

    address which when visited with contain the link to proceed. This link gives y=the new

    customer the option of login in with the new created username and password to proceed with

    the checkout. This time the new customer will be asked for shipping information which might

    be different from the already provided billing information:

    Which after being provided will direct the customer to the confirmation page :

    From here the customer is taken to the payment page where the bank details are provided

  • 8/3/2019 Henry(Database Design & Implementation)

    10/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    10

    From the site the processes involved in purchase are broken down into:

    Item selection Shopping cart Billing information Shipping information

    The lists of fields that have been selected from this site are:

    Product Product color Product size Product Quantity Login Name Password Password confirmation Full Name: Address Postcode

    State I/C Number Phone Number Email Shipping Full Name Shipping Email Shipping Address Shipping State Shipping Post Code Shipping phone Number

  • 8/3/2019 Henry(Database Design & Implementation)

    11/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    11

    2.2 Second Site

    The second site to be examined is luvclothez.com. To place an order from the site, the purchaser

    selects an item from the lists of items displayed under the categories menus by the right hand side of

    the home page

    For the purpose this documentation the clothing category is selected

    This displays images of available products from which the Japanese Style Two Rows Button Halter

    Dress (Black) is selected for the purpose of this documentation. This takes the purchaser to the

    Categories

  • 8/3/2019 Henry(Database Design & Implementation)

    12/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    12

    products details page with shows more images of the selected product and a detailed description of the

    product with and option of selecting the quantity needed and add to cart:

  • 8/3/2019 Henry(Database Design & Implementation)

    13/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    13

    The purchaser proceeds to the shopping cart

    From the shopping cart the purchaser has the option of selecting to continue shopping or checkout.

    The checkout option is selected for the purpose of this documentation. And this presents the purchaser

    with option to either sign up as a new customer or to login as a returning customer:

  • 8/3/2019 Henry(Database Design & Implementation)

    14/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    14

    The sign up option is selected for the purpose of this documentation and it takes the new customer to

    the page where the account information is imputed:

  • 8/3/2019 Henry(Database Design & Implementation)

    15/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    15

    Field giving the following fields:

    YOUR PERSONAL DETAILS

    Company Details

    Company Name

    Address Details

    First Name:

    Last Name:

    Street Address:

    Address Line 2:

    City:

    State/Province:

    Post/Zip Code:

    Country:

    Additional Contact Details

    Telephone:

    Verify Your Age

    Date of Birth:

    Login Details

  • 8/3/2019 Henry(Database Design & Implementation)

    16/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    16

    Email Address:

    Password:

    Confirm Password:

    The next page shows the delivery information which offers the option of changing the shipping

    information

    After which the continue checkout is selected and next page the customer is asked for paymentinformation in which he select a payment method and proceed to checkout:

    The next page is the order confirmation with the payment and billing information and the shoppingcart contents:

  • 8/3/2019 Henry(Database Design & Implementation)

    17/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    17

    Therefore to make an order, four steps are necessary

    Item selection Shopping Cart Delivery Information Payment Information

  • 8/3/2019 Henry(Database Design & Implementation)

    18/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    18

    The necessary fields to make an order in the luvclothez.com site are:

    Product Quantity Company Name First Name: Last Name: Street Address Address line 2 City State/province Country Telephone Date of birth E-Mail Address: Password Password Confirmation Address: Town Post Code: City: Title Payment method Card type Credit Card Number Expiry date Card security number Shipping First Name Shipping Last Name Shipping Address Shipping City Shipping State Shipping Post Code Shipping Country

  • 8/3/2019 Henry(Database Design & Implementation)

    19/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    19

    2.3 Third Site

    The third site tiezone.com.my which is a tie selling and like the other two sites the ordering processes

    are similar. The purchaser browses the shop by collection categories by the left hand side of the site:

    For the purpose of this documentation the stripes option was selected:

    This displays images of available ties with their unit prices and the option of add to cart under eachproduct. And for the purpose of this documentation the CASERINI NECKTIE 110 was selected and

  • 8/3/2019 Henry(Database Design & Implementation)

    20/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    20

    this takes the purchaser to the products description page and the option of selecting the quantity of

    products needed and then add to cart:

    The next page displays the shopping cart with the selected item and the proceed to checkout button:

    When the proceed to checkout is selected, the shopper is presented with the form for billing and

    account details:

  • 8/3/2019 Henry(Database Design & Implementation)

    21/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    21

    Where he will be required to enter the following fields for billing details:

    Email Address:

    Password:

    Confirm Password:

    First Name:

    Last Name:

    Company Name:

    Phone Number:Address Line 1:

    Address Line 2:

    Suburb/City:

    Country:

    State/Province:

    Zip/Postcode:

  • 8/3/2019 Henry(Database Design & Implementation)

    22/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    22

    Then the shipping details page which will require the following fields:

    First Name:

    Last Name:

    Company Name:

    Phone Number:

    Address Line 1:

    Address Line 2:

    Suburb/City:

    Country:

    State/Province:

    Zip/Postcode:

  • 8/3/2019 Henry(Database Design & Implementation)

    23/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    23

    Then the shipping method:

    And order confirmation:

    And then the checkout page:

  • 8/3/2019 Henry(Database Design & Implementation)

    24/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    24

    Therefore to place an order there is four stages:

    Item selection

    Shopping cart Billing information Shipping details

    List of attributes from tiezone.com.my are:

    Product

    Quantity

    Email Address:

    Password:

    Confirm Password:

    First Name:

  • 8/3/2019 Henry(Database Design & Implementation)

    25/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    25

    Last Name:

    Company Name:

    Phone Number:

    Address Line 1:

    Address Line 2:

    Suburb/City:

    Country:

    State/Province:

    Shipping Zip/Postcode:

    Shipping First Name:

    Shipping Last Name:

    Shipping Company Name:

    Shipping Phone Number:

    Shipping Address Line 1:

    Shipping Address Line 2:

    Shipping Suburb/City:

    Shipping Country:

    Shipping State/Province:

    Shipping Zip/Postcode:

  • 8/3/2019 Henry(Database Design & Implementation)

    26/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    26

    2.4 Conclusion

    Below is a table that compares the compulsory fields from the three sites:

    www.360degree.com.my luvclothez.com tiezone.com.my

    Product

    Product color

    Product size

    Product Quantity

    Login Name

    Password

    Password confirmation

    Full Name:Address

    Postcode

    State

    I/C Number

    Phone Number

    Email

    Shipping Full Name

    Shipping Email

    Shipping Address

    Shipping State

    Shipping Post Code

    Shipping phone Number

    Product

    Quantity

    Company Name

    First Name:

    Last Name:

    Street Address

    Address line 2

    CityState/province

    Country

    Telephone

    Date of birth

    E-Mail Address:

    Password

    Password Confirmation

    Address:

    Town

    Post Code:

    City:

    Title

    Payment method

    Card type

    Credit Card Number

    Expiry date

    Card security number

    Shipping First Name

    Shipping Last Name

    Shipping Address

    Shipping City

    Shipping State

    Product

    Quantity

    Email Address:

    Password:

    Confirm Password:

    First Name:

    Last Name:

    Company Name:Phone Number:

    Address Line 1:

    Address Line 2:

    Suburb/City:

    Country:

    State/Province:

    Shipping Zip/Postcode:

    Shipping First Name:

    Shipping Last Name:

    Shipping Company Name:

    Shipping Phone Number:

    Shipping Address Line 1:

    Shipping Address Line 2:

    Shipping Suburb/City:

    Shipping Country:

    Shipping State/Province:

    Shipping Zip/Postcode:

  • 8/3/2019 Henry(Database Design & Implementation)

    27/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    27

    Shipping Post Code

    Shipping Country

    From the above table it can be seen that there are lots of similarities in the fields required to

    select a product. And from these three lists the following generic list can be gotten:

    2.4.1 Generic List

    Product Name

    Quantity in stock

    Size

    ProductID

    First Name:

    Last Name:

    Date of Birth:

    E-Mail Address:

    Street Address:

    Password

    Post Code:

    City:

    E-Mail Address:

    Payment method

    Card type

    Credit Card Number

    Expiry date

    Card security number

  • 8/3/2019 Henry(Database Design & Implementation)

    28/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    28

    Name on card

    Shipping First Name

    Shipping Last Name

    Shipping Address

    Shipping City

    Shipping State

    Shipping Post Code

    Shipping Country

    2.4.2 Added Attributes

    And for the purpose of illustration the following fields were added to the generic list

    Added attribute Reasons

    Category ID

    Product type

    Product price

    product Description

    Product Image

    Stock Quantity

    ProductID

    CustomerID

    CategoryID

    CategoryName

    CategoryDescripion

    Brand ID

    Brand name

    Order number

    Customer number

    every item is identified with its ID

    Differentiates every product

    Prices of each product

    Every brand in the store has an ID

    Each brand is differentiated by its brand name

    After purchase every customer has an order number for orders placed

    Every customer who places an order is given a unique number to

    identify different customer

  • 8/3/2019 Henry(Database Design & Implementation)

    29/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    29

    2.4.3 rejected attributes

    The following attributes were rejected for the giving reasons

    Rejected attribute reasons

    Delivery location type

    Business/ Institution name

    State/Province

    password confirmation

    Its the same as shipping address

    Same as address

    Same as state

    Not needed for database

    3.0 NORMALIZATION

    1NF 2NF 3NF

  • 8/3/2019 Henry(Database Design & Implementation)

    30/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    30

    Category ID

    Category description

    Category type

    Brand ID

    Brand name

    Brand type

    Product type

    Product name

    Product price

    Product image

    Product ID

    Product quantity

    Amount

    Order Number

    Order details

    Invoice number

    Order date

    Customer IDFirst name

    Last name

    Date of birth

    Address

    City

    State

    Zip code

    Country

    Phone number

    Shipping method

    Delivery date

    Payment typeCard type

    Card number

    Expiration date

    Security code

    Email address

    Shipping First Name

    Shipping Last Name

    Shipping Address

    Shipping City

    Shipping State

    Shipping Post Code

    Shipping Country

    Customer ID

    First name

    Last name

    Address

    City

    State

    Zip code

    Country

    Phone number

    Email address

    --------------------------------

    Category ID

    Category type

    Category description

    --------------------------------

    Category ID *

    Product ID *

    Brand nameBrand type

    ---------------------------------

    Product ID

    Product type

    Product price

    Product image

    Product quantity

    ---------------------------------

    Customer ID *

    Order Number

    Order details

    Invoice numberOrder date

    ---------------------------------

    Customer ID*

    Tracking number

    Shipping method

    Delivery date

    Shipping Address

    ---------------------------------

    Customer ID *

    Card number

    Payment type

    Card typeExpiration date

    Security code

    Customer ID

    First name

    Last name

    Address

    City

    State

    Zip code

    Country

    Phone number

    Email address

    Category ID

    Category type

    Category description

    Category ID *

    Product ID *

    Brand name

    Brand type

    Product IDCategory ID *

    Product type

    Product price

    Product image

    Product quantity

    Customer ID *

    Order Number

    Order details

    Invoice number

    Order date

    Customer ID*Tracking number

    Shipping method

    Delivery date

    Shipping Address

    Customer ID *

    Card number

    Payment type

    Card type

    Expiration date

    Security code

    CUSTOMERCustomer ID

    First name

    Last name

    DateOfBirth

    Address

    City

    State

    Zip code

    Country

    Phone number

    Email address

    CATEGORYCategory ID

    Category type

    Category description

    BRANDBrandID

    Brand name

    Brand type

    PRODUCTCategory ID *

    BrandID*

    Product ID

    Product type

    Product Name

    Product price

    Product image

    Product quantity

    SHIPPING

    DETAILSOrder Number *

    Card number*

    Tracking number

    Shipping method

    Delivery date

    Shipping First Name

    Shipping Last Name

    Shipping Address

    Shipping CityShipping State

    Shipping Post Code

    Shipping Country

    PAYMENTCustomer ID *

    Card number

    Payment type

    Card type

    Expiration date

    Security code

    ORDERCustomer ID *

    Product ID*

  • 8/3/2019 Henry(Database Design & Implementation)

    31/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    31

    Order Number

    Order details

    Invoice number

    Order date

  • 8/3/2019 Henry(Database Design & Implementation)

    32/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    32

    4.0 ERD

    CUSTOMER

    PAYMENT

    ORDER

    SHIPPING DETAILS CATEGORY

    BRAND

    PRODUCT

  • 8/3/2019 Henry(Database Design & Implementation)

    33/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    33

    5.0 EER DIAGRAM

    CATEGORY BRAND

    PRODUCT

    CUSTOMER

    ORDER SHIPPING DETAILS

    belong belong

    Belong

    contain

    Belong

    For

    categoryID

    categoryType

    categoryDes_

    crition

    brandID

    brandType

    brandName

    productID

    customerID

    emailAdd

    firstName

    phoneNumber

    city

    lastName

    address

    state

    zipCode

    country

    productPrice

    productImage

    productType

    productQty

    orderNumber

    orderDate

    orderDetails

    deliveryDate

    shippingMethod

    shippingCountry

    shippingCity

    shippingState

    shippingPCode

    1

    n

    1

    n

    n

    1n

    1

    trackingNumber

    shippingMethod

    shippingLName

    deliveryDate

    shippingFName

    shippingAddress

    n

    PAYMENT

    cardID_

    cardType

    expiryDate

    securityCode

    holderName

    n1

    dateOfBirth

    productName

  • 8/3/2019 Henry(Database Design & Implementation)

    34/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    34

    6.0 DATA SCHEMA

    SHIPPING DETAILS

    Order Number *

    Card number*

    Tracking number

    Shipping method

    Delivery date

    Shipping First Name

    Shipping Last Name

    Shipping Address

    Shipping City

    Shipping State

    Shipping Post Code

    Shipping Country

    CATEGORY

    Category ID

    Category type

    Category description

    BRAND

    BrandID

    Brand name

    Brand type

    PRODUCT

    Category ID *

    BrandID*

    Product ID

    Product type

    ProductName

    Product price

    Product image

    Product uantit

    PAYMENT

    Customer ID *

    Card number

    Payment type

    Card type

    Expiration date

    Security code

    CUSTOMER

    Customer ID

    First name

    Last name

    Address

    DateOfBirth

    City

    State

    Zip code

    Country

    Phone number

    ORDER

    Customer ID *

    Product ID*

    Order Number

    Order details

    Invoice number

    Order date

  • 8/3/2019 Henry(Database Design & Implementation)

    35/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    35

    7.0 TABLE SCHEMA

    ENTIRY/ATTRIBUTES DESCRIPTION PRIMARY KEY FOREIGN KEY

    CUSTOMER

    Customer ID

    First name

    Last namedateOfBirth

    Address

    City

    State

    Zip code

    Country

    Phone number

    Email address

    varchar(50)

    varchar(50)

    varchar(50)date

    varchar(150)

    varchar(50)

    varchar(50)

    int

    varchar(50)

    int

    varchar(100)

    Primary key

    CATEGORY

    Category ID

    Category type

    Category description

    varchar(50)

    Varchar(50)

    Varchar(80)

    Primary key

    BRAND

    BrandID

    Brand name

    Brand type

    varchar(50)

    Varchar(80)

    Varchar(50)

    Primary key

    PRODUCT

    Category ID

    BrandID

    Product ID

    Product type

    Product Name

    Product price

    Product image

    ProductQty

    varchar(50)

    varchar(50)

    varchar(50)

    Varchar(50)

    Varchar(50)

    int

    Varchar(80)

    int

    Primary key

    Foreign key

    Foreign key

    SHIPPING DETAILS

    orderNumber

    cardNumber

    Tracking number

    Shipping methodDelivery date

    shippingFName

    shippingLName

    shippingAddress

    shippingCity

    shippingState

    shippingPCode

    shippingCountry

    varchar(50)

    int

    varchar(50)

    Varchar(50)Date

    Varchar(50)

    Varchar(50)

    Varchar(150)

    Varchar(50)

    Varchar(50)

    Int

    Varchar(50)

    Primary key

    Foreign key

    Foreign key

    PAYMENT

    Customer ID

    Card number

    Payment typeCard type

    varchar(50)

    Int

    Varchar(50)Varchar(50)

    Primary key

    Foreign key

  • 8/3/2019 Henry(Database Design & Implementation)

    36/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    36

    Expiration date

    Security code

    Date

    int

    ORDER

    Customer ID

    Product ID

    Order Number

    Order details

    Invoice number

    Order date

    varchar(50)

    varchar(50)

    Int

    Varchar(100)

    Int

    date

    Primary key

    Foreign key

    Foreign key

  • 8/3/2019 Henry(Database Design & Implementation)

    37/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    37

    8.0 PART 4

    8.1 Creation of databases

    This is the creation of database HENRYCOMMERCIALS

    Creating tables

  • 8/3/2019 Henry(Database Design & Implementation)

    38/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    38

  • 8/3/2019 Henry(Database Design & Implementation)

    39/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    39

    8.2 INSERTING INTO TABLES

  • 8/3/2019 Henry(Database Design & Implementation)

    40/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    40

  • 8/3/2019 Henry(Database Design & Implementation)

    41/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    41

  • 8/3/2019 Henry(Database Design & Implementation)

    42/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    42

    9.0 QUERIES

    9.1 1ST

    QUERY:

    BREIF DESCRIPTION: this query works with multiple tables. In this particular usage I worked with

    three tables; PAYMENT, ORDER_DETAILS and CUSTOMER tables. The query uses the

    paymentType from the PAYMENT table to map the customerID which is a foreign key to thePAYMENT table and which also is a foreign key to the ORDER_DETAILS table. And with that is

    able to pull data from the firstName and expiryDate in CUSTOMER table, securityCode from the

    PAYMENT table and orderDetails from the ORDER_DETAILS table and display them. The resulting

    query is as follows:

    SELECT

    CUSTOMER.firstName,PAYMENT.securityCode,ORDER_DETAILS.orderDetails,PAYMENT.expi

    ryDate

    FROM CUSTOMER,PAYMENT,ORDER_DETAILS

    WHERE PAYMENT.paymentType = 'card'

    AND PAYMENT.customerID = CUSTOMER.customerID

    AND CUSTOMER.customerID = ORDER_DETAILS.customerID;

  • 8/3/2019 Henry(Database Design & Implementation)

    43/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    43

    9.2 2ND

    QUERY:

    SELECT CUSTOMER.customerID,CUSTOMER.firstName,

    COUNT(PAYMENT.expiryDate) as DUE_DATE

    FROM CUSTOMER LEFT JOIN PAYMENT

    ON CUSTOMER.customerID = PAYMENT.customerID

    GROUP BY CUSTOMER.customerID;

    9.3 3RD

    QUERY:

    SELECT BRAND.brandName,CATEGORY.categoryDescription,

    COUNT(PRODUCT.productQty) AS count, AVG(PRODUCT.productQty) AS average

    FROM BRAND,PRODUCT,CATEGORY

    WHERE BRAND.brandID = PRODUCT.brandID

    AND PRODUCT.categoryID = CATEGORY.categoryID

    GROUP BY BRAND.brandName,CATEGORY.categoryDescription;

  • 8/3/2019 Henry(Database Design & Implementation)

    44/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    44

    9.4 4TH

    QUERY:

    SELECT p1.shippingFName,p2.shippingLName,p1.deliveryDate

    FROM SHIPPING_DETAILS AS p1,SHIPPING_DETAILS AS p2

    WHERE MONTH(p1.deliveryDate) != MONTH(p2.deliveryDate)

    AND DAYOFMONTH(p1.deliveryDate) != DAYOFMONTH(p2.deliveryDate)

    AND(p1.shippingFName != p2.shippingFName OR p1.shippingLName != p2.shippingLName)

    ORDER BY p1.shippingFName;

  • 8/3/2019 Henry(Database Design & Implementation)

    45/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    45

    9.5 5TH

    QUERY:

    BRIEF DESCRIPTION:

    SELECT

    PAYMENT.paymentType,ORDER_DETAILS.orderDate,CUSTOMER.firstName,ORDER_DETAIL

    S.orderDetails

    FROM ORDER_DETAILS,CUSTOMER,PAYMENT

    WHERE ORDER_DETAILS.orderDate != '2010-01-10'

    AND ORDER_DETAILS.customerID = CUSTOMER.customerID

    AND CUSTOMER.customerID = PAYMENT.customerID;

  • 8/3/2019 Henry(Database Design & Implementation)

    46/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    46

    10.0 CONCLUSION

    This documentation has successfully commercialized the HENRYCOMMERCIALS database and has

    been able to show some of its functionalities by the running of some queries.

  • 8/3/2019 Henry(Database Design & Implementation)

    47/47

    HENRY CHINEDU IROANYAH DATABASE DESIGN AND IMPLEMENTATION 0970042

    11.0 REFERENCES

    Dev.mysql.com.Boolean Full-Text Searches [online]

    Available at:http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html

    [Accessed: 10

    th

    November 2010]

    O'Reilly & Associates.2001.MySQL & MySQL [online]

    Available at:http://docstore.mik.ua/orelly/linux/sql/ch15_01.htm

    [Accessed: 11th

    November 2010]

    360DEGREE.COM.MY. [online]

    Available at:http://www.360degree.com.my/index.php?page=HOME

    [Accessed: 1st

    December 2010]

    LuvClothez.Online Fashion Store [online]

    Available at:http://luvclothez.com/

    [Accessed: 6th

    December 2010]

    TIEZONE.2007-2010. Online store [online]

    Available at:http://tiezone.com.my/

    [Accessed: 18th

    November 2010]

    http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.htmlhttp://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.htmlhttp://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.htmlhttp://docstore.mik.ua/orelly/linux/sql/ch15_01.htmhttp://docstore.mik.ua/orelly/linux/sql/ch15_01.htmhttp://docstore.mik.ua/orelly/linux/sql/ch15_01.htmhttp://www.360degree.com.my/index.php?page=HOMEhttp://www.360degree.com.my/index.php?page=HOMEhttp://www.360degree.com.my/index.php?page=HOMEhttp://luvclothez.com/http://luvclothez.com/http://luvclothez.com/http://tiezone.com.my/http://tiezone.com.my/http://tiezone.com.my/http://tiezone.com.my/http://luvclothez.com/http://www.360degree.com.my/index.php?page=HOMEhttp://docstore.mik.ua/orelly/linux/sql/ch15_01.htmhttp://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html