MBIS4002
MBIS4002
By
Professor’s Name
University
June 2020
Australian Manufacturing Company (AMC) Database System 2
Table of Contents
1. Background..................................................................................................................................3
1.1 Requirements.............................................................................................................................3
1.1.1 User Requirements..................................................................................................................3
1.1.2 System requirements...............................................................................................................3
1.1.3 Software requirements............................................................................................................3
1.1.4 Hardware Requirements.........................................................................................................3
1.1.5 Business Rules........................................................................................................................4
1.2 Mission statement......................................................................................................................5
1.3 DBMS Selection........................................................................................................................5
2. Entity Relationship Diagrams......................................................................................................5
3. Normalized Schema.....................................................................................................................8
4. Database Schema.........................................................................................................................9
5. Foreign key constraints..............................................................................................................12
6. X12 SQL Statements.................................................................................................................18
7. Challenges & solutions..............................................................................................................22
Australian Manufacturing Company (AMC) Database System 3
1. Background
1.1 Requirements
set of constraints, demands, necessities, needs and parameters on a specified system which
User requirements provides descripted content on functionality and quality expected by users. In
order to identify user needs proper assumptions and enquires has to be taken place. The user
requirements for AMC include customer details management, product details, payment methods,
System requirements meets the functions and characteristics of the system designed to carry out
stakeholders expectations. It describes the features and behaviors of the system and also it
includes elements to define the intended functionality required to satisfy the users. Customer
registration should be done storing customer number, first name, last name, contact number and
address. Customer category and customer number has to be provided to each customer.
OS – Windows 8 or higher
The database will accept two user types: admin and user which will be affected by adding a
column userType in the users table The database will only accept orders from registered known
users. The user must not be null in the orders table. The cart table will be stored with a foreign
key userId which can be null. This ensures that the customers who are logged in can have a
personalized cart that is linked to the account and is persistent. This way the cart can also be
accessed from multiple devices provided the user is not null. The order table will have an auto
generated column called orderRef which will be unique and will be used to identify the orders.
This unique string will be used to track the order by the client through every stage of order
processing up to order delivery. The user table must have both email and phone columns which
will be used in order table as foreign keys so as to communicate with the user.
The user table must have unique phone and email columns. This prevents a single email or phone
to be used to register a single user more than once. The order table will have a price column and
a total cost column. The total cost will be the summation of both the price of the item and the
delivery cost. The database will have an order tracking table that will track orders according to
the orderRef above. Once the order has been received, and confirmed the ‘received’ column will
be populated. The database will have a reviews column that will only be populated by registered
users. The reviews table can only be populated after the user order tracking is completed and this
will ensure that only users who have successfully purchased an item can rate and review it. These
Australian Manufacturing Company (AMC) Database System 5
reviews will be displayed on other similar products by including it as a foreign key in the
products table
Australian Manufacturing Company builds on the mission of making a great database viable
development skills through developing and enhancing skills, supporting ventures that inspire
The appropriate DBMS for Australian Manufacturing Company is MS SQL server. MS SQL
server offers various robust features which are easy to use and effective in managing school
database. The DMBS has a data size limit of 10GB. This is a relatively high data cap considering
the kind of data stored by the school. This data size limit can support school operations without
limiting the amount of data that can be stored. DBMS costs less compared to the purchase costs
of Oracle, IBM DB2, and MYSQL. With MS SQL Server, the school will incur fewer costs but
get quality service. The DBMS has high availability which implies that here will be less
downtime and ensures that the school database is accessible at all times.
The database being relational will have the following tables that will represent the entities that
will be stored:
a) Stores Table – the store stable will hold the specific store details of all the stores under
AMC. Each store will be identifiable by a unique key store number. The store number
Australian Manufacturing Company (AMC) Database System 6
will also be the primary key in this table. The store table will also have the location and
contact details
b) Department Table – the department table will store details about all the departments
under every store. These departments will have a unique department number and a
foreign key store number to identify which specific store the department is under. The
table will also have a column representing the department name for example HR,
c) Employee Table – This table will contain all the employees’ details and the departments
in which they work under. The unique table in this case will be the employee number.
There will be a foreign key department to identify each employee with a specific
department. The employee’s salary and date of employment will also be recorded. The
type of employee will also be recorded. We will have three types of employees:
d) Payslip Table – this table will record all the payments processed by AMC and will have a
unique id which will be the payslip number. The payslip will be based on the hours
e) Products Table – this table will have all the products sold at the different stores. Each
product will have a unique product number and will belong to a specific category. The
different categories will include fashion, health, electronics, beauty etc. Each product will
also have a quantity column, and upon the quantity is subtracted upon each sale. This will
f) Supplier Table – this table will keep track of all suppliers that are supplying AMC stores.
Each supplier will be recorded according to the category of product the supply and will
g) Inventory Table – upon delivery of products by suppliers, the details of the products will
be stored in an inventory table. The quantity and price of each item or items acquired.
The quantity column will also be a foreign key in the products table. When a sale is
made, the quantity column in the inventory table is reduced by the number of items sold.
h) Customers Table- this table will keep track of all customers and identify them with a
i) Orders Table – this table will record all the orders made by customers. Each order will
have an auto generated string or characters that will act as the order reference number.
Australian Manufacturing Company (AMC) Database System 8
Australian Manufacturing Company (AMC) Database System 9
3. Normalized Schema
The table will be normalized by removing all transitive dependencies. When an attribute depends
transitive dependency. This will increase data integrity and reduce data duplication.
storeNo name phoneN faxNo Street suburb address postcode city email
o
1 Store 32435 2453 Street Sub one Add one 112 City one Email
one one one
2 Store 25465 3453 Street Sub two Add two 211 City two Email tw
two two
The following store table can be normalized with 3NF by separating this table into three tables. A
store table, location table and contacts table. This distinct tables will ensure that incidences of
Store table
Contacts table
Location/Address Table
4. Database Schema
Employee
Field Name Data Type Length Key Constraints
employeeNo varchar 100 Primary Key
firstname varchar 100 Not null
lastname varchar 100 Not null
email varchar 100 unique
pnone varchar 100 unique
address varchar 100 unique
salary varchar 100 Not null
departmentNo integer 10 Foreign key
storeNo integer 10 Foreign Key
employee_type_id integer 10 Foreign Key
State
Field Name Data Type Length Key Constraints
State_id integer 10 Primary Key
State_name varchar 100 Not null
Postal_code varchar 100 unique
Street
Field Name Data Type Length Key Constraints
Street_id integer 10 Primary Key
Street_name varchar 100 Not null
State_id varchar 100 unique
Australian Manufacturing Company (AMC) Database System 11
Employee Type
Field Name Data Type Length Key Constraints
employee_type_id integer 10 Primary Key
employee_type_name varchar 100 Not null
Employee_type_rate integer 10 Not null
Department
Field Name Data Type Length Key constraints
departmentNo integer 10 Primary Key
name varchar 100 Not null
storeNo integer 10 Foreign key
phone varchar 100 unique
email varchar 100 unique
Payslip
Field Name Data Type Length Key constraints
pay_slip_id integer 10 Primary Key
Employee_No integer 10 Foreign Key
No_of_hours_worked integer 10 Not null
storeNo integer 10 Foreign Key
gross_salary integer 10 Not null
Products
Field Name Data Type Length Key Constraints
productNo integer 10 Primary Key
product_category_id integer 10 Foreign Key
product_name varchar 100 Not null
store_no integer 10 Foreign Key
price integer 10 Not null
ProductCategory
Field Name Data Type Length Key Constraints
Product_category_id integer 10 Primary Key
Product_category_nam varchar 100 Foreign Key
e
Supplier
Australian Manufacturing Company (AMC) Database System 12
Inventory
Field Name Data Type Length Key Constraints
inventoryNo integer 10 Primary Key
productNo integer 10 Foreign Key
quantity integer 10 Not null
Customer
Field Name Data Type Length Key Constraints
customerNo integer 10 Primary Key
First_name varchar 100 Not null
Last_name varchar 100 Not null
email varchar 100 unique
phone varchar 100 unique
Order
Field Name Data Type Length Key Constraints
orderNo varchar 100 Primary Key
productNo integer 10 Foreign Key
customerNo integer 10 Foreign Key
store_id integer 10 Foreign Key
Amount_ordered integer 10 Not null
Date_ordered date - Not null
Number 1
Australian Manufacturing Company (AMC) Database System 13
Number 2
Australian Manufacturing Company (AMC) Database System 14
Number 3
Number 4
Number 5
Australian Manufacturing Company (AMC) Database System 15
Number 6
Number 7
Australian Manufacturing Company (AMC) Database System 16
Number 8
Number 9
Australian Manufacturing Company (AMC) Database System 17
Number 10
Number 11
Australian Manufacturing Company (AMC) Database System 18
Number 1
Query select CONCAT(first_name,' ',last_name) as fullname, email,
phone, address from customer ORDER BY phone desc
Number 2
Query select product_name from product where price <100
Output product_name
--------------
Bread
soap
(2 rows)
Australian Manufacturing Company (AMC) Database System 19
Number 3
Query select order_table.product_no, product_name, amount_ordered,
SUM(price), (amount_ordered*price) as total from order_table
LEFT JOIN product on
order_table.product_no=product.product_no
WHERE order_no='1005'
GROUP BY order_table.product_no, product_name,
amount_ordered, price
Output product_no | product_name | amount_ordered | sum | total
------------+--------------+----------------+-----+-------
1 | Bread | 500 | 50 | 25000
(1 row)
Number 4
Query SELECT store_name,
CONCAT( street_name, ',', state_name, ' ',
postal_code) as address, store_fax
from street
LEFT JOIN store on
street.street_id=store.store_location_id
LEFT JOIN state on street.state_id=
"state".state_id
where UPPER(street_name) LIKE
UPPER('%GEORGE%')
Number 5
Query select order_no FROM
(SELECT COUNT(DISTINCT product_no)>2 as distinctproducts,
order_no from order_table GROUP BY order_no) as
ordersabovetwoproducts
Output order_no
----------
1007
1005
1008
1006
(4 rows)
Number 6
Query select customer_no, first_name, last_name from
customer where order_no > '0'
Output customer_no | first_name | last_name
-------------+------------+-----------
(0 rows)
Number 7
Number 8
Number 9
Number 10
Query select customer_no, COUNT(order_no) FROM order_table
GROUP BY customer_no
Output customer_no | count
-------------+-------
01 | 4
(1 row)
Australian Manufacturing Company (AMC) Database System 22
Number 11
Query select order_no, date_ordered, COUNT(product_no) FROM
order_table
GROUP BY order_no
ORDER BY order_no
Output order_no | date_ordered | count
----------+--------------+-------
1005 | 2020-05-13 | 1
1006 | 2017-06-30 | 1
1007 | 2017-07-30 | 1
1008 | 2018-07-01 | 1
Based on the database the minor challenge would be the abundance of entities that would be used
through the entire database. Since the database also tracks guest’s complaints, past stays, and
preferences and other valuable information, the ERD would be complex and would require
attentiveness to details. The major challenges would be deciding and presenting the relationships
between the tables. As a result of using an ERM, the developers would be able to navigate
through the database easier because it would act like a blueprint. In addition, it lays out the
details of the database so that the developers can look through and make sure the requirements
for the database are being met. What this shows us is that the developers will have less
conflicting goals because they will be able to make sure they achieve them by reviewing the