SlideShare a Scribd company logo
1 of 37
19
Database Systems
October 17, 2016
Contents
I. Database System Overview 3
1. Context 3
2. Database System Goals and Objectives Statement 4
3. How the proposed Database System addresses the Business
Problems? 4
4. How the Proposed Systems aligns to the Mission Statement
and Strategic Goals of the Organization? 5
5. Mission and Goals of the Retail Store 6
6. Conclusion 7
II. Entity Relationship Model 8
1. Relational Database Proposal for online Retail Shop 8
2. ER Model and Relational Model 9
3. Converting ER Diagram to Relational Model 14
4. ER Tables Normalization 17
III. Structured Query Language (SQL) Scripts 18
IV. Database Administration Plan 19
V. Future Database System Implementation Plan 20
VI. References 21
Database System Overview
Database management systems or DBMS is a technology of
retrieving and storing users’ data with utmost efficiency and
appropriate security measures. The retail store Company is
experiencing increased growth in the recent weeks. The
customers expressed their interest in purchasing their products
electronically. The Company’s website is simple, but it is not
clear, if the Company,is in a position, of receiving online
purchases. The Company aims at eventually integrating to
online purchasingusing the current order entry system. This
research project gives a description of the general business
environment of the retail store Company. Referencing database
objectives, statements, and system goals. Included is a narrative
discussing how the proposed DBS addresses the current
organization problem.
Context
Development of the retail store online could provide a lucrative
alternative increase in sales by attracting customers, meeting
the needs of the organization, and market expansion. However,
conducting an online retail store creates some environmental
considerations. The general business environment defines the
external and internal factors that influence the Company’s
operating situation. The business environment includes
suppliers, clients, competitors, technology, government
activities, and laws.(Elmasri & Navathe, Fundamentals of
Fourth Edition Database Systems, 2005)
Database System Goals and Objectives Statement
Objectives and goals define what the database project will
accomplish or the value of the database project to the business.
Database designers should keep in mind six aims during the
design of any database system. First, provide a mass storage of
the relevant data. Second, protect data from unauthorized
access. Such as, in the current database system of the retail
store, allows promotional, and discountsof products, when not
authorized. Third, the database system must aim at allowing
growth. Some of the orders in the retail store, is not available,
when required. Fourth, data systems should aim at making
access of the order, easy access to the users of the system.
Fifth, a database system should eliminate redundant data and
allow many users to access to the database simultaneously.
Sixth, a database system should make the latest modifications to
the database available immediately.(Rob & Coronel, 2002)
How the proposed Database System addresses the Business
Problems?
The retail shop scenario explains that the employees rely greatly
on paper-based sales and invoices. The Company needs to
consider the time that is wasted on tasks that database systems
can handle at an instant. The same also, goes to the financial
reporting mechanism that is currently being employed by the
Company. Currently the retail company takes ages to reconcile
and consolidate financial data; a database system can make an
important impact. (Elmasri & Navathe, Fundamentals of Fourth
Edition Database Systems, 2005)
The retail company is growing significantly in the recent
months; one of the biggest challenges faced by the retail
company is inventory management. Ensuring that the right order
is in the right customer at the right time is a vital for the
organization operations. In addition, when sales, customer data,
and inventory is maintained separately, the current view of the
retail store, can create serious problems in the Company. If the
Company runs out of a popular product, the sales will be off,
until the next shipment arrives. In addition, if a consumer, or a
customer, makes an inquiry about their order, and the
employees are unable to track, if the order is being shipped, or
if it is in the company’s current inventory, the retail company,
will develop a bad reputation, for customer service, and
reliability. Database systems help in tracking orders and
answers, customers’ questions; with ease and gives the exact
shipping status of the order. (Elmasri & Navathe, Fundamentals
of Fourth Edition Database Systems, 2005)
How the Proposed Systems aligns to the Mission Statement and
Strategic Goals of the Organization?
The proposed system defines the components, rules, the
roadmap that governsEnterprise Resource Planning (ERP)
utilization, and deployment. The proposed system takes into
account the mission of the company, the organizational goals,
and the strategies of the retail Company. First, the proposed
system enables the standardization of the Companies’ process
and the use of the best practices. Second, the proposed will
provide the necessary information, which is readily available
for decision making, for performing individual tasks, and
planning. Third, the proposed system will enable data
management, better handling of master data, definition of
information, and transactional data. In addition, the proposed
system, will result the retail company, to be more efficient,
positive customer service, governmental compliance, and
minimized operational costs.(Dittrich & Geppert, 2001)
The prosed system is business intelligence based, this will help
in analyzing data, and decision making. The best feature of the
proposed system, is that all data and information, is kept by the
company, which includes the central repository, or the data is
saved, in a single database. This helps in answering all the
questions posed by a customer,resulting in
delivering,outstanding customer service. In conclusion, the
proposed system assists in improved security and availability of
data, better information transparency, better harmonization of
all the IT infrastructure, high quality of organizational
processes, better information quality, and transparency.(Dittrich
& Geppert, 2001)
Mission and Goals of the Retail Store
The mission of the retail store company is to work together and
employ current technology in an online database infrastructure,
lowering the cost of production of the organization, and achieve
an increased profit margin. In order, to full fill this mission the
retail shop will work on the unique procedures that have an
open door policy, all the managers in the retail company, are
open to collaboration of all the employees, at all levels and
answering, customers, and supplier questions, on a daily basis.
The goals of the retail store company comprise of the following:
First, the system should not allow discounts and promotional
products. Second, the orders must be available for customers
and the customer service platform should be effective. Third,
the orders must not be misdirected. Fourth, the current database,
must be up to date, with the current stock, and inventory. Fifth,
the online platform must include credit processing, discount
offers, shipping options, and purchasing. Lastly, the system
must provide high security to both the customer’s data and the
organization’s sensitive information. (Robinson & Robinson,
2005)
Conclusion
The proposed systems have revolutionized organizations and
Companies around the globe. An example, is Wal-Mart stores
have relied heavily on online stores and ERP systems to carry
out its daily activities. This has made the company harvest
increased profits in recent years. This research project includes
discussion of the database system objectives statement and
goals. Including the needed goals for the proposed system. In
part two, I was able to show how the proposed system will
address some of the business problems. In conclusion,analysis
of how the proposed system aligns the strategic goals of the
organization and identification of the mission and the goals of
the organization. With these four parts, a description of a
general business environment for the presented case study.
Entity Relationship Model
Relational Database Proposal for online Retail Shop
The retail company will offer products online because of
customer demand. The company has faced many challenges in
the recent past which have made operations very inefficient.
The current system in use has no documentation which does
show a system blueprint for errors, corrections, or even any
attempts, to improve the system. Customer orders get lost,
products in the inventoryare out of stock, and customer tracking
is often difficult. Also,customers are often awarded promotional
goods and discounts undeservingly. There is a need to install
controls to curb this abuse of the system. The proposed database
system will ensure all organizational operations is
accomplishedefficiently.
ER Model and Relational Model
The diagram below presents a recommended relational database
that the company should use. The design takes into account the
challenges of the retail store.
Figure 1: ER Diagram
Entity-Relationship model is a high-level description of thedata
model. It is utilized extensively in conceptual designing of
relational schema databases. The requirements of a database
developed are usually laid down in a top-down
structure.(Elmasri & Navathe, Data Modeling Using the Entity
Relationship (ER) Model, 2011)
ER diagrams are the diagrams drawn using the standard. Entities
are represented as points, or polygons, and relationships are
shown using lines that connect entities. From an ER diagram, it
is easy to obtain a relational table, aiding in optimizing designs,
and in debugging systems. From the case scenario, various
entities were identified that need implementation,in reference to
problems faced within the current system. (Teory, 2011)
These entities are as follows:
1. Customer – this entity refers to anyone who makes an order
on the company’s website. Roles of a customer include checking
out products through theorder. This entity relates to order and
discount relations as every customer makes an order. A client
must at least make an order in a view to qualify for thediscount.
This is a control measure put in place to curb unwarranted
discounts to undeserving clients.(Teory, 2011)
2. Order – it represents a single transaction when a customer
purchases items. This order relates to the store, by checking the
availability of the product in question.(Teory, 2011)
3. Product - represents individual item that the company offers
to its customers.
4. Inventory – represents different types of reports generated in
combination with other entities. These reports include cost of
stocks, inventory per items, inventory total’s, amongst other
many reports.(Teory, 2011)
5. Store – this is the actual storage place where products are
stored and customers can get them from.
6. Employee –this is an entity that represents a person that
supervises all operations of the online store. Employee entity
relates to many other tables like the approving discounts on
discount relation, processing orders, etc.
7. Discounts – this is an entity for providing an extra service or
product to the customer.
8. Constraints – different types of constraints that have to be
implemented to ensure optimum performance of the database.
(Teory, 2011)
Entity integrity constraintsensures that the primary key field
cannot be NULL. It is because a primary key field, is used to
uniquely,to identify a record, and having no value, in this field,
means that we cannot identify, some tuples in a relation.
(Elmasri & Navathe, Data Modeling Using the Entity
Relationship (ER) Model, 2011)
We also, have the primary and unique key constraint. It is a
norm, to have an attribute that identifies, every entity in a table.
Such an attribute is referred to as akey attribute. In some
instances, more than one attribute may be used to form the key
attribute. When this happens, we refer to the key as composite.
This key needs to be minimal as much as possible, but has to
contain all attributes that will express, theexplicit uniqueness of
an entity.(Elmasri & Navathe, Data Modeling Using the Entity
Relationship (ER) Model, 2011)
According to Graves,referential integrity constraint is used,
whenever, there are two relations, and its prime purpose, is to
uphold consistency, in the tuples, of the relating tables. It is
basically defined, as a tuple in one relation that relating to a
tuple, in another relation. It just means, having a foreign key,
which references a primary key, in another relation.(Graves,
2002)
Finally, there are check constraints, which help define, the valid
data, whenever, we are adding, or updating data, in a relational
database. A check constraint, must be a predicate, and has to be
applied, in each tuple. It must be able to refer either to a single
or many columns of a relation. The output we get from check
constraint, is either TRUE, FALSE or even UNKNOWN. The
outcome is dependent on the NULL values present in a tuple.
(Graves, 2002)
The last set of constraints we need to use are the business rules.
These are the constraints that we cannot express directly in data
models but have to be enforced by application programs.
(Silverston, 2013)
Some of those rules which must be implemented are as
follows:A customer must place one order with a view to qualify
for a discount or promotional product.One and only one product
belongs to one category.Aclient can make many orders.An order
can have more than one discount since each order has many
products.One employee can process many orders.One or many
employees can manage many stores.Each customer discount can
have many products.Only one employee can serve one customer,
with many discounts; since a customer can place an order with
many products.Only one product entry is found in an inventory.
(Silverston, 2013)
Looking at the diagrammatic representation above, we have
tried to represent these rules on every table relation, even
though each, and every one, has to be implemented,at the
application level.
Converting ER Diagram to Relational Model
A good ER diagram allows us to derive relational tables
efficiently. From the ER above, this section presents detailed
models of the tables including the data types, description of
each field, and their relationships.
Customers table
Field
Description
CustomerId[PK]
Integer value and auto generated
FirstName
128-letter character string
SecondName
PhoneNo
10-digit character string ranging from 0 to 9
Email
128-letter character string
City
50 character string ranging from A to Z
Candidate keys: FirstName, econdName, PhoneNo, Email,
Employee Table
Field
Description
EmployeeId[PK]
Integer value and auto generated
EmployeeName
128-letter character string
Position
50-letter character string
SSN
character string ranging from 0 to 9
PhoneNo
10-digit character string ranging from 0 to 9
Email
128-letter character string
City
50 character string ranging from A to Z
Order
Field
Description
OrderId
Primary key Auto-generated integer
EmployeeId[FK]
Integer value referencing employees table
CustomerID [FK]
Integer value referencing Customers table
ProductId
Integer value referencing products table
Orderdate
Date over which order was made
Quantity
Integer digit describing number of items bought
TotalCost
Double number with a two digit precision(Currency)
City
50 character string ranging from A to Z
Candidate keys are:OrderId, CustomerId, productId
Filed to index is OrderId
Product Table
Field
Description
Id
Primary key Auto-generated integer for identifying the product
Name
128-letter character string
categoryId
Integer value referencing product Category table
Price
Double digit number with precision of two digits
Description
1000-letter character string describing each product
Inventory table
Field
Description
InventoryId
Primary key Auto-generated integer
EmployeeId
Integer foreign key to employees table
StoreId
Integer foreign key referencing Stores table
ProductId
Integer foreign key referencing products table
Quantity
Integer digit describing number of items in stock
Description
1000-letter character string describing each product
Candidate keys are:StoreID, ProductID
Filed to index is: StoreID, ProductID
Discount table
Field
Description
DiscountID
Primary key Auto-generated integer value
CustomerId
Integer foreign key to Customers table
EmployeeID
Integer foreign key to employees table
OrderId
Integer foreign key referencing orders table
Description
1000-letter character string describing each Discount
Category table
Field
Description
CategoryId
Primary key Auto-generated integer value
CategoryName
128-letter character string
Description
1000-letter character string describing each Discount
Store Table
Field
Description
StoreId
Primary key Auto-generated integer value
StoreName
128-letter character string
Candidate key:StoreId
Field to index:StoreId
ER Tables Normalization
Normalization is a process that is usually used to ensure
database design achieves minimal data redundancy and
providing sensible data dependencies. The databaseis associated
with operations like insertion, deletion, updating. Without
proper normalization, these tasksbecome difficult to perform
and may lead to data loss at times. And when not the case, the
database becomes very redundant. Harrington and Harrington,
explains how normalization is achieved using the forms; 1NF,
2NF, 4NF and the 4NF. (Harrington, 2009)
To satisfy 1NF form, duplicative columns must be eliminated on
a table. In a case where there are such repeating columns, then
the table is broken down, into two, so that each column,can
hold, an atomic value. The rows must have unique columns.
Looking at our design of the retail store database, all the tables
satisfies this condition. For example, if we look at the product
table in the diagram ERabove, all the fields are dependent on
the primary key field, Id. If we try to add two or three rows of
data to our table, we will realize that there is not duplication.
We can, therefore, say that our design satisfies 1NF of
normalization forms. The 2NF forms require that a database
must meet 1NF conditions and then all the subsets of multiple
rows be removed, and placed on separate tables. In the 3NF, all
fields that do not depend on the primary key field are removed
to form new table. The above design has satisfied all these
conditions. For instance, there are relationships defined, for
each table, as well as, the keys relating them. (Silverston,
2013)Structured Query Language (SQL) Scripts
Database Administration Plan
Future Database System Implementation Plan
References
CustomerProductInventoryOrderEmployeeStoreDiscountsProduc
tCategorycustomer_id(Int)PKFirst
Name(string)SecondName(string)emai l(String)PhoneNo
(string)City (string)Name
(string)CategoryIdPrice(Currency)Description
(string)InventoryId(int)PKProductId
(Int)FKQuantity(int)StoreId (int)FKOrderId (Int)PKProductId
(int)FKCustomerId (Int)FKOrderDate (Date)Quantity
(Int)TotalCost (Currency)Name (string)Position
(string)SSN(Int)PhoneNo((string))StoreID (Int)PKAddress
(string)ManagesEmployeeId (Int)FKServesDiscountId
(Int)PKCustomerId (Int)FKDescription (string)EmployeeId
(int)FKCategoryName(String)CategoryId [int]PKBelongs
toDescription(String)PKOrderIdFKGives Discounts/
Promotional ProductsEmail
(String)EmployeeIdFKEmployeeIdPKIdPK
Customer
Product
Inventory
Order
Employee
Store
Discounts
ProductCategory
customer_id(Int)
int
FK
PK
First Name(string)
int
FK
PK
SecondName(string)
int
FK
PK
emai l(String)
int
FK
PK
PhoneNo (string)
int
FK
PK
City (string)
int
FK
PK
Name (string)
int
FK
PK
CategoryId
int
FK
PK
Price(Currency)
int
FK
PK
Description (string)
int
FK
PK
InventoryId(int)
int
FK
PK
ProductId (Int)
int
FK
PK
Quantity(int)
int
FK
PK
StoreId (int)
int
FK
PK
OrderId (Int)
int
FK
PK
ProductId (int)
int
FK
PK
CustomerId (Int)
int
FK
PK
OrderDate (Date)
int
FK
PK
Quantity (Int)
int
FK
PK
TotalCost (Currency)
int
FK
PK
Name (string)
int
FK
PK
Position (string)
int
FK
PK
SSN(Int)
int
FK
PK
PhoneNo((string))
int
FK
PK
M1
M2
M3
M4
StoreID (Int)
int
FK
PK
Address (string)
int
FK
PK
Manages
M1
M2
M3
M4
EmployeeId (Int)
int
FK
PK
Serves
M1
M2
M3
M4
DiscountId (Int)
int
FK
PK
CustomerId (Int)
int
FK
PK
Description (string)
int
FK
PK
M1
M2
M3
M4
M1
M2
M3
M4
EmployeeId (int)
int
FK
PK
M1
M2
M3
M4
M1
M2
M3
M4
CategoryName(String)
int
FK
PK
CategoryId [int]
int
FK
PK
Belongs to
M1
M2
M3
M4
Description(String)
int
FK
PK
OrderId
int
FK
PK
Gives Discounts/ Promotional Products
M1
M2
M3
M4
Email (String)
int
FK
PK
M1
M2
M3
M4
M1
M2
M3
M4
EmployeeId
int
FK
PK
M1
M2
M3
M4
M1
M2
M3
M4
EmployeeId
int
FK
PK
Id
int
FK
PK
U3_Worked_Examples/CROSSTAB.sql
--CROSSTAB EXAMPLE
USE storemanager
GO
--CHECK TO SEE IF TABLE EXISTS AND IF SO, DROP AND
RECREATE TABLE
IF EXISTS(SELECT 1
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND TABLE_NAME = 'Crosstab')
DROP TABLE Crosstab
GO
--CREATE TABLE FOR DEMONSTRATION PURPOSES
CREATE TABLE Crosstab
( Year SMALLINT,
Quarter TINYINT,
Amount DECIMAL(2,1) )
GO
INSERT INTO Crosstab VALUES (2010, 1, 1.1)
INSERT INTO Crosstab VALUES (2010, 2, 1.2)
INSERT INTO Crosstab VALUES (2010, 3, 1.3)
INSERT INTO Crosstab VALUES (2010, 4, 1.4)
INSERT INTO Crosstab VALUES (2011, 1, 2.1)
INSERT INTO Crosstab VALUES (2011, 2, 2.2)
INSERT INTO Crosstab VALUES (2011, 3, 2.3)
INSERT INTO Crosstab VALUES (2011, 4, 2.4)
GO
--SELECT the SUM of each quarter, grouped by year:
SELECT Year,
SUM(CASE Quarter WHEN 1 THEN Amount ELSE 0 END)
AS Q1,
SUM(CASE Quarter WHEN 2 THEN Amount ELSE 0 END)
AS Q2,
SUM(CASE Quarter WHEN 3 THEN Amount ELSE 0 END)
AS Q3,
SUM(CASE Quarter WHEN 4 THEN Amount ELSE 0 END)
AS Q4
FROM storemanager.dbo.Crosstab
GROUP BY Year
GO
U3_Worked_Examples/DDL.pdf
1C:UsersMarcelloDropboxCourse ...Course
MaterialsWorked ExamplesDDL.sql
USE master
GO
--CHECK TO SEE IF DATABASE EXISTS AND IF SO, DROP
AND RECREATE DATABASE
IF EXISTS(SELECT name FROM sys.databases
WHERE name = 'storemanager')
DROP DATABASE storemanager
GO
CREATE DATABASE [storemanager]
GO
--SWITCH TO DATABASE
USE storemanager
--CREATE TABLES
CREATE TABLE tblStores
(
StoreID char(10) NOT NULL PRIMARY KEY,
StoreName varchar(25) NOT NULL,
StoreAddress1 char(35),
StoreAddress2 char(35),
StoreCity varchar(20),
StoreState char(2),
StoreZip char(10)
)
CREATE TABLE tblDepartments
(
DeptID char(10) NOT NULL PRIMARY KEY,
DeptName varchar(20) NOT NULL,
StoreID char(10) FOREIGN KEY REFERENCES
tblStores(StoreID)
)
U3_Worked_Examples/DDL.sql
USE master
GO
--CHECK TO SEE IF DATABASE EXISTS AND IF SO, DROP
AND RECREATE DATABASE
IF EXISTS(SELECT name FROM sys.databases
WHERE name = 'storemanager')
DROP DATABASE storemanager
GO
CREATE DATABASE [storemanager]
GO
--SWITCH TO DATABASE
USE storemanager
--CREATE TABLES
CREATE TABLE tblStores
(
StoreID char(10) NOT NULL PRIMARY KEY,
StoreName varchar(25) NOT NULL,
StoreAddress1 char(35),
StoreAddress2 char(35),
StoreCity varchar(20),
StoreState char(2),
StoreZip char(10)
)
CREATE TABLE tblDepartments
(
DeptID char(10) NOT NULL PRIMARY KEY,
DeptName varchar(20) NOT NULL,
StoreID char(10) FOREIGN KEY REFERENCES
tblStores(StoreID)
)
U3_Worked_Examples/DELETE UPDATE SQL.pdf
1C:UsersMarcelloDropboxCourse ...MaterialsWorked
ExamplesDELETE UPDATE.sql
--switch to the correct database
USE storemanager
GO
--update store city in tblstores based on StoreID
UPDATE tblStores
SET StoreCity = 'Hampton'
WHERE StoreID = '1005'
--To delete a parent record in which there is one or more related
child records, the child
records
--must be deleted first before the parent
--delete department associated with store that needs to be
deleted from tblstores based on
StoreID
BEGIN TRAN
DELETE FROM tblDepartments
where StoreID = '1000'
COMMIT TRAN;
--delete store from tblstores based on StoreID (USING A
TRANSACTION WITH ERROR HANDLER)
BEGIN TRAN
DELETE FROM tblStores
where StoreID = '1001'
IF (@@ERROR <> 0) BEGIN
PRINT 'Unexpected error occurred!'
ROLLBACK TRAN
END
COMMIT TRAN
U3_Worked_Examples/DELETE UPDATE.sql
--switch to the correct database
USE storemanager
GO
--update store city in tblstores based on StoreID
UPDATE tblStores
SET StoreCity = 'Hampton'
WHERE StoreID = '1005'
--To delete a parent record in which there is one or more related
child records, the child records
--must be deleted first before the parent
--delete department associated with store that needs to be
deleted from tblstores based on StoreID
BEGIN TRAN
DELETE FROM tblDepartments
where StoreID = '1000'
COMMIT TRAN;
--delete store from tblstores based on StoreID (USING A
TRANSACTION WITH ERROR HANDLER)
BEGIN TRAN
DELETE FROM tblStores
where StoreID = '1001'
IF (@@ERROR <> 0) BEGIN
PRINT 'Unexpected error occurred!'
ROLLBACK TRAN
END
COMMIT TRAN
U3_Worked_Examples/DML.pdf
1C:UsersMarcelloDropboxCourse ...Course
MaterialsWorked ExamplesDML.sql
--SWITCH TO DATABASE
USE storemanager
--INSERT RECORDS IN THE CORRECT ORDER, BASED ON
DEPENDENCIES (PARENT BEFORE CHILD)
INSERT INTO tblStores
VALUES ('1000','ABC Company', '100 Main Street', '',
'Clinton','NJ','08809')
INSERT INTO tblStores
VALUES ('1001','XYZ Company', '8 Oak Street', '',
'Hampton','NJ','08827')
INSERT INTO tblStores
VALUES ('1002','John West Ltd.', '110 Main Street', '',
'Clinton','NJ','08809')
INSERT INTO tblStores
VALUES ('1003','Jacobs Store', '52 Lexal Ave.', '', 'Loch
Sheldrake','NY','12759')
INSERT INTO tblStores
VALUES ('1004','Harris Store', '10 South Blvd.', '',
'Newburgh','NY','12437')
INSERT INTO tblStores
VALUES ('1005','Johnson Company', '50 Main Street', '',
'Clinton','NJ','08809')
INSERT INTO tblDepartments
VALUES ('10','Accounting', '1000')
INSERT INTO tblDepartments
VALUES ('11','Human Resources', '1000')
INSERT INTO tblDepartments
VALUES ('12','Shipping', '1001')
INSERT INTO tblDepartments
VALUES ('13','Accounting', '1002')
INSERT INTO tblDepartments
VALUES ('14','Human Resources', '1003')
INSERT INTO tblDepartments
VALUES ('15','Shipping', '1004')
U3_Worked_Examples/DML.sql
--SWITCH TO DATABASE
USE storemanager
--INSERT RECORDS IN THE CORRECT ORDER, BASED ON
DEPENDENCIES (PARENT BEFORE CHILD)
INSERT INTO tblStores
VALUES ('1000','ABC Company', '100 Main Street', '',
'Clinton','NJ','08809')
INSERT INTO tblStores
VALUES ('1001','XYZ Company', '8 Oak Street', '',
'Hampton','NJ','08827')
INSERT INTO tblStores
VALUES ('1002','John West Ltd.', '110 Main Street', '',
'Clinton','NJ','08809')
INSERT INTO tblStores
VALUES ('1003','Jacobs Store', '52 Lexal Ave.', '', 'Loch
Sheldrake','NY','12759')
INSERT INTO tblStores
VALUES ('1004','Harris Store', '10 South Blvd.', '',
'Newburgh','NY','12437')
INSERT INTO tblStores
VALUES ('1005','Johnson Company', '50 Main Street', '',
'Clinton','NJ','08809')
INSERT INTO tblDepartments
VALUES ('10','Accounting', '1000')
INSERT INTO tblDepartments
VALUES ('11','Human Resources', '1000')
INSERT INTO tblDepartments
VALUES ('12','Shipping', '1001')
INSERT INTO tblDepartments
VALUES ('13','Accounting', '1002')
INSERT INTO tblDepartments
VALUES ('14','Human Resources', '1003')
INSERT INTO tblDepartments
VALUES ('15','Shipping', '1004')
U3_Worked_Examples/REPORT SELECT.pdf
1C:UsersMarcelloDropboxCourse ...Worked
ExamplesREPORT SELECT.sql
1
2 USE storemanager
3
4 --SELECT ALL STORES AND THEIR RELATED
DEPARTMENTS
5 SELECT tblStores.storeID, StoreName, DeptName
6 FROM tblStores
7 INNER JOIN tblDepartments
8 on tblStores.storeID = tblDepartments.storeID
9
10 --SELECT A STORE AND ITS RELATED DEPARTMENTS
11 SELECT tblStores.storeID, StoreName, DeptName
12 FROM tblStores
13 INNER JOIN tblDepartments
14 on tblStores.storeID = tblDepartments.storeID
15 WHERE tblStores.StoreName = 'ABC Company'
16
17 --AGGREGATE QUERY SHOWING TOTAL COUNT OF
DEPARTMENTS PER STORE
18
19 SELECT StoreID, COUNT(DeptID) as "Number of
Departments"
20 FROM tblDepartments
21 GROUP BY StoreID
22
23
U3_Worked_Examples/Thumbs.db
COMPANY SCENARIO
A retail store wants to offer its products online in response to
numerous customers requesting to be able to purchase the
company’s products electronically. The company is beginning to
see some growth in spite of the recent economic downturn. The
company strives to meet the needs of its customers, including
giving them the perception that they are the company’s highest
priority. Being a profitable operation has not always been the
case, and the company has historically struggled with customer
service issues, inventory-management problems, employee
turnover, and poor productivity overall. Naturally, the
stakeholders of the company began to lose faith in the viability
of the company, and unfortunately, numerous stakeholders have
dissolved their relationship with the retail store entirely.
Approximately 7 years ago, the company hired a freelance
information technology (IT) organization to create a data-driven
information system that would support customer records and
order entry. The store manager convinced the owner of the
company that this route was the way to go. After all, anything
would be an improvement over what the company had at the
time. The owner felt that because it was important to have an
efficient way to track customers and orders, any computerized
system would be sufficient. He was not too proud to share his
lack of technological skills, and often deferred to others when it
came to making decisions in this area. He often joked that
perhaps some computer training would do him and his
employees some good. He was never really assured that his data
were backed up correctly or that his system was secure. And
what if the system crashed or the data started to appear unusual?
He also had never heard of any of his employees backing up the
system files. If he lost all of his data, he would not know where
to turn or what to do. The very idea of his business depending
so much on technology was almost too stressful to think about.
Deep down, however, he really wanted some assurance that his
information was reliable and secure.
The customer records and order entry system that was installed
solved a few problems for the short term but quickly proved to
lack the capability to meet the goals, objectives, and overall
data needs of the company. The freelance technology company
provided no documentation on how to use the system or even
how it was designed. A large component that was missing was
having the ability to track the product inventory. The system in
its current state does not seem to be fully functional and often
lets employees override the store procedures that the owner has
clearly stated should be adhered to. For example, customers are
given discounts when they are not eligible, certain products are
completely depleted from inventory without being flagged for
reorder, and prospects who have never placed an order are set
up as customers with a fake order to give them free product
samples and promotional materials. This usually involves a
person who is friends with an employee collaborating to set up
fake order for a product that is not even real.
Although the owner does not feel that he is very technically
proficient, he admits that perhaps he should have researched the
needs of his company and the possible options before jumping
on the first opportunity that presented itself. He knows that he
reacted to the problem instead of responding in an effective
manner. After all of that trouble, employees cannot keep track
of customer records, orders get misplaced on the system, and
products that are not in inventory keep coming up as available.
The problem has gotten so bad that the owner has directed all
employees to resort back to the manual method to handle all
daily business transactions.
At this point in the company’s history, the need for positive
changes is apparent to the owner. He is committed to his
company and his customers. He values all of the input that
stakeholders have provided to him over the years and knows
that with a little determination, the company can be a success.
His employees are loyal to him and appreciate his attentiveness
to their needs and concerns. He knows that each employee is
good at solving problems and wants to able to reward all of
them by recognizing when they are able to solve problems for
the company. He sees his employees as dedicated and capable of
meeting any of the goals and objectives that he sets for them.
He often compliments them on the cleanliness of the store and
the way that the shelves are organized. He has told them that the
company takes pride in its appearance and ability to greet the
customer with a smile. This includes having the products that
the customer wants at a reasonable price; that is what he
calls customer service.
Perspectives:
Kelly, Customer Service Representative
“Every time customers call me and want to know the status of
their order, I feel like it takes forever for the system to provide
a simple answer to a simple question. I can understand why
customers get frustrated with us because all they want is to
know what is going on with their order. After all, they are
trying to coordinate their busy lives and such. I feel like an
idiot when I cannot answer the customer right away, and I am
upset because I thought this system would make things better. I
feel like I spend more time listening to customers complain, and
it makes me uncomfortable.”
Mark, Cashier
“I don’t understand why I can’t simply give the customers a
break sometimes. I know they should not get a discount all the
time, but if I know them, I think it is good customer service to
make them happy. Plus, the system allows me to do it. If this
was such a bad thing, then the system should not allow me to
give discounts and promotional products when I am not
supposed to.”
Sandy, Product Manager
“This new system was supposed to help me manage product
inventory more efficiently but it isn’t. I do not have time to go
back into the warehouse and count everything. I told customers
that we had plenty of stock, and we actually had none in the
warehouse, so naturally the customers are really angry with me.
But it is not my fault. The system told a different story, and I
relied on the system to be right. Now the owner is mad at me
because he thinks I am not capable of doing my job. He says I
should always check to make sure that the system is not lying,
but I don’t have the time to do this!”
Ralph, Store Manager
“I really thought a new system was the way to go; after all,
technology is supposed to solve all problems, right? Why can’t
things just work? The owner is really upset because we spend so
much time trying to fix problems that occur on a daily basis that
we do not have time to make things better in the store. At this
point, we will never be able to sell our products online. We
cannot even manage the store we have! Orders get misplaced,
customers are angry because the wrong products come in on
their orders, and I am really tired. I just don’t understand it. I
have seen technology actually help businesses run more
smoothly. Why does technology not work for us?”
Ellen, Customer
"I love the convenience of shopping online. With my busy
lifestyle, I have no time to go shopping at the store for what I
need. I do appreciate being treated with respect as a customer
too. After all, I should get the product I want at a fair price and
should have the ability to choose from a wide selection. I love
the websites that have customer support options so that I can
call if I have a problem. I will be honest, however, that I have
little patience for order mix-ups and things like that. A company
that sticks by its word, though, means a lot to me. We all make
mistakes; it's how we fix those mistakes that matters."

More Related Content

Similar to 19Database SystemsOctober 17, 2016ContentsI..docx

Semantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data LakeSemantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data LakeCognizant
 
Business Intelligence Module 2
Business Intelligence Module 2Business Intelligence Module 2
Business Intelligence Module 2Home
 
Semantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data LakeSemantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data LakeThomas Kelly, PMP
 
Enhanced Order and Demand Management Systems1Enhanced Order and.docx
Enhanced Order and Demand Management Systems1Enhanced Order and.docxEnhanced Order and Demand Management Systems1Enhanced Order and.docx
Enhanced Order and Demand Management Systems1Enhanced Order and.docxSALU18
 
Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017
Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017
Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017Lora Cecere
 
MIS563 ALAKart Milestone 3 - Pam Gabriel
MIS563 ALAKart Milestone 3 - Pam GabrielMIS563 ALAKart Milestone 3 - Pam Gabriel
MIS563 ALAKart Milestone 3 - Pam GabrielPamelia Gabriel
 
Data Mining Based Store Layout Architecture for Supermarket
Data Mining Based Store Layout Architecture for SupermarketData Mining Based Store Layout Architecture for Supermarket
Data Mining Based Store Layout Architecture for SupermarketIRJET Journal
 
Group 1 Presentation after mid.pptx
Group 1 Presentation after mid.pptxGroup 1 Presentation after mid.pptx
Group 1 Presentation after mid.pptxSarahSriKurniasih
 
Information-Systems-and-Technology.pptx
Information-Systems-and-Technology.pptxInformation-Systems-and-Technology.pptx
Information-Systems-and-Technology.pptxAhimsaBhardwaj
 
DATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docx
DATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docxDATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docx
DATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docxwhittemorelucilla
 
3 recent development
3 recent development3 recent development
3 recent developmentsakshi garg
 
A Data Warehouse And Business Intelligence Application
A Data Warehouse And Business Intelligence ApplicationA Data Warehouse And Business Intelligence Application
A Data Warehouse And Business Intelligence ApplicationKate Subramanian
 
Seminar (1).pptx
Seminar (1).pptxSeminar (1).pptx
Seminar (1).pptxGirum6
 
Data warehousing interview questions
Data warehousing interview questionsData warehousing interview questions
Data warehousing interview questionsSatyam Jaiswal
 
Achieving operational excellence and customer intimacy
Achieving operational excellence and customer intimacyAchieving operational excellence and customer intimacy
Achieving operational excellence and customer intimacyProf. Othman Alsalloum
 
Information Technology in Online Shopping1Information .docx
Information Technology in Online Shopping1Information .docxInformation Technology in Online Shopping1Information .docx
Information Technology in Online Shopping1Information .docxdirkrplav
 

Similar to 19Database SystemsOctober 17, 2016ContentsI..docx (20)

Semantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data LakeSemantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data Lake
 
IT in retail
IT in retailIT in retail
IT in retail
 
Business Intelligence Module 2
Business Intelligence Module 2Business Intelligence Module 2
Business Intelligence Module 2
 
Erp and related technologies
Erp and related technologiesErp and related technologies
Erp and related technologies
 
Ihop Cs Slide Final Xp
Ihop Cs Slide Final   XpIhop Cs Slide Final   Xp
Ihop Cs Slide Final Xp
 
Semantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data LakeSemantic 'Radar' Steers Users to Insights in the Data Lake
Semantic 'Radar' Steers Users to Insights in the Data Lake
 
Enhanced Order and Demand Management Systems1Enhanced Order and.docx
Enhanced Order and Demand Management Systems1Enhanced Order and.docxEnhanced Order and Demand Management Systems1Enhanced Order and.docx
Enhanced Order and Demand Management Systems1Enhanced Order and.docx
 
Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017
Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017
Driving Digital Supply Chain Transformation - A Handbook - 23 MAY 2017
 
MIS563 ALAKart Milestone 3 - Pam Gabriel
MIS563 ALAKart Milestone 3 - Pam GabrielMIS563 ALAKart Milestone 3 - Pam Gabriel
MIS563 ALAKart Milestone 3 - Pam Gabriel
 
Data Mining Based Store Layout Architecture for Supermarket
Data Mining Based Store Layout Architecture for SupermarketData Mining Based Store Layout Architecture for Supermarket
Data Mining Based Store Layout Architecture for Supermarket
 
Group 1 Presentation after mid.pptx
Group 1 Presentation after mid.pptxGroup 1 Presentation after mid.pptx
Group 1 Presentation after mid.pptx
 
Information-Systems-and-Technology.pptx
Information-Systems-and-Technology.pptxInformation-Systems-and-Technology.pptx
Information-Systems-and-Technology.pptx
 
DATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docx
DATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docxDATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docx
DATABASE SYSTEMS DEVELOPMENT & IMPLEMENTATION PLAN1DATABASE SYS.docx
 
3 recent development
3 recent development3 recent development
3 recent development
 
A Data Warehouse And Business Intelligence Application
A Data Warehouse And Business Intelligence ApplicationA Data Warehouse And Business Intelligence Application
A Data Warehouse And Business Intelligence Application
 
Seminar (1).pptx
Seminar (1).pptxSeminar (1).pptx
Seminar (1).pptx
 
Data warehousing interview questions
Data warehousing interview questionsData warehousing interview questions
Data warehousing interview questions
 
Unlocking big data
Unlocking big dataUnlocking big data
Unlocking big data
 
Achieving operational excellence and customer intimacy
Achieving operational excellence and customer intimacyAchieving operational excellence and customer intimacy
Achieving operational excellence and customer intimacy
 
Information Technology in Online Shopping1Information .docx
Information Technology in Online Shopping1Information .docxInformation Technology in Online Shopping1Information .docx
Information Technology in Online Shopping1Information .docx
 

More from felicidaddinwoodie

Business UseWeek 1 Assignment #1Instructions1. Plea.docx
Business UseWeek 1 Assignment #1Instructions1. Plea.docxBusiness UseWeek 1 Assignment #1Instructions1. Plea.docx
Business UseWeek 1 Assignment #1Instructions1. Plea.docxfelicidaddinwoodie
 
Business UsePALADIN ASSIGNMENT ScenarioYou are give.docx
Business UsePALADIN ASSIGNMENT ScenarioYou are give.docxBusiness UsePALADIN ASSIGNMENT ScenarioYou are give.docx
Business UsePALADIN ASSIGNMENT ScenarioYou are give.docxfelicidaddinwoodie
 
Business UsePractical Connection WorkThis work is a writte.docx
Business UsePractical Connection WorkThis work is a writte.docxBusiness UsePractical Connection WorkThis work is a writte.docx
Business UsePractical Connection WorkThis work is a writte.docxfelicidaddinwoodie
 
Business System AnalystSUMMARY· Cognos Business.docx
Business System AnalystSUMMARY· Cognos Business.docxBusiness System AnalystSUMMARY· Cognos Business.docx
Business System AnalystSUMMARY· Cognos Business.docxfelicidaddinwoodie
 
Business StrategyOrganizations have to develop an international .docx
Business StrategyOrganizations have to develop an international .docxBusiness StrategyOrganizations have to develop an international .docx
Business StrategyOrganizations have to develop an international .docxfelicidaddinwoodie
 
Business StrategyGroup BCase Study- KFC Business Analysis.docx
Business StrategyGroup BCase Study- KFC Business Analysis.docxBusiness StrategyGroup BCase Study- KFC Business Analysis.docx
Business StrategyGroup BCase Study- KFC Business Analysis.docxfelicidaddinwoodie
 
Business Strategy Differentiation, Cost Leadership, a.docx
Business Strategy Differentiation, Cost Leadership, a.docxBusiness Strategy Differentiation, Cost Leadership, a.docx
Business Strategy Differentiation, Cost Leadership, a.docxfelicidaddinwoodie
 
Business Research Methods, 11e, CooperSchindler1case.docx
Business Research Methods, 11e, CooperSchindler1case.docxBusiness Research Methods, 11e, CooperSchindler1case.docx
Business Research Methods, 11e, CooperSchindler1case.docxfelicidaddinwoodie
 
Business RequirementsReference number Document Control.docx
Business RequirementsReference number Document Control.docxBusiness RequirementsReference number Document Control.docx
Business RequirementsReference number Document Control.docxfelicidaddinwoodie
 
Business ProposalThe Business Proposal is the major writing .docx
Business ProposalThe Business Proposal is the major writing .docxBusiness ProposalThe Business Proposal is the major writing .docx
Business ProposalThe Business Proposal is the major writing .docxfelicidaddinwoodie
 
Business ProjectProject Progress Evaluation Feedback Form .docx
Business ProjectProject Progress Evaluation Feedback Form .docxBusiness ProjectProject Progress Evaluation Feedback Form .docx
Business ProjectProject Progress Evaluation Feedback Form .docxfelicidaddinwoodie
 
BUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docx
BUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docxBUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docx
BUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docxfelicidaddinwoodie
 
Business Process Management JournalBusiness process manageme.docx
Business Process Management JournalBusiness process manageme.docxBusiness Process Management JournalBusiness process manageme.docx
Business Process Management JournalBusiness process manageme.docxfelicidaddinwoodie
 
Business Process DiagramACCESS for ELL.docx
Business Process DiagramACCESS for ELL.docxBusiness Process DiagramACCESS for ELL.docx
Business Process DiagramACCESS for ELL.docxfelicidaddinwoodie
 
Business Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docx
Business Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docxBusiness Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docx
Business Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docxfelicidaddinwoodie
 
Business PlanCover Page  Name of Project, Contact Info, Da.docx
Business PlanCover Page  Name of Project, Contact Info, Da.docxBusiness PlanCover Page  Name of Project, Contact Info, Da.docx
Business PlanCover Page  Name of Project, Contact Info, Da.docxfelicidaddinwoodie
 
Business Planning and Program Planning A strategic plan.docx
Business Planning and Program Planning          A strategic plan.docxBusiness Planning and Program Planning          A strategic plan.docx
Business Planning and Program Planning A strategic plan.docxfelicidaddinwoodie
 
Business Plan In your assigned journal, describe the entity you wil.docx
Business Plan In your assigned journal, describe the entity you wil.docxBusiness Plan In your assigned journal, describe the entity you wil.docx
Business Plan In your assigned journal, describe the entity you wil.docxfelicidaddinwoodie
 
Business Plan Part IVPart IV of the Business PlanPart IV of .docx
Business Plan Part IVPart IV of the Business PlanPart IV of .docxBusiness Plan Part IVPart IV of the Business PlanPart IV of .docx
Business Plan Part IVPart IV of the Business PlanPart IV of .docxfelicidaddinwoodie
 
BUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docx
BUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docxBUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docx
BUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docxfelicidaddinwoodie
 

More from felicidaddinwoodie (20)

Business UseWeek 1 Assignment #1Instructions1. Plea.docx
Business UseWeek 1 Assignment #1Instructions1. Plea.docxBusiness UseWeek 1 Assignment #1Instructions1. Plea.docx
Business UseWeek 1 Assignment #1Instructions1. Plea.docx
 
Business UsePALADIN ASSIGNMENT ScenarioYou are give.docx
Business UsePALADIN ASSIGNMENT ScenarioYou are give.docxBusiness UsePALADIN ASSIGNMENT ScenarioYou are give.docx
Business UsePALADIN ASSIGNMENT ScenarioYou are give.docx
 
Business UsePractical Connection WorkThis work is a writte.docx
Business UsePractical Connection WorkThis work is a writte.docxBusiness UsePractical Connection WorkThis work is a writte.docx
Business UsePractical Connection WorkThis work is a writte.docx
 
Business System AnalystSUMMARY· Cognos Business.docx
Business System AnalystSUMMARY· Cognos Business.docxBusiness System AnalystSUMMARY· Cognos Business.docx
Business System AnalystSUMMARY· Cognos Business.docx
 
Business StrategyOrganizations have to develop an international .docx
Business StrategyOrganizations have to develop an international .docxBusiness StrategyOrganizations have to develop an international .docx
Business StrategyOrganizations have to develop an international .docx
 
Business StrategyGroup BCase Study- KFC Business Analysis.docx
Business StrategyGroup BCase Study- KFC Business Analysis.docxBusiness StrategyGroup BCase Study- KFC Business Analysis.docx
Business StrategyGroup BCase Study- KFC Business Analysis.docx
 
Business Strategy Differentiation, Cost Leadership, a.docx
Business Strategy Differentiation, Cost Leadership, a.docxBusiness Strategy Differentiation, Cost Leadership, a.docx
Business Strategy Differentiation, Cost Leadership, a.docx
 
Business Research Methods, 11e, CooperSchindler1case.docx
Business Research Methods, 11e, CooperSchindler1case.docxBusiness Research Methods, 11e, CooperSchindler1case.docx
Business Research Methods, 11e, CooperSchindler1case.docx
 
Business RequirementsReference number Document Control.docx
Business RequirementsReference number Document Control.docxBusiness RequirementsReference number Document Control.docx
Business RequirementsReference number Document Control.docx
 
Business ProposalThe Business Proposal is the major writing .docx
Business ProposalThe Business Proposal is the major writing .docxBusiness ProposalThe Business Proposal is the major writing .docx
Business ProposalThe Business Proposal is the major writing .docx
 
Business ProjectProject Progress Evaluation Feedback Form .docx
Business ProjectProject Progress Evaluation Feedback Form .docxBusiness ProjectProject Progress Evaluation Feedback Form .docx
Business ProjectProject Progress Evaluation Feedback Form .docx
 
BUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docx
BUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docxBUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docx
BUSINESS PROCESSES IN THE FUNCTION OF COST MANAGEMENT IN H.docx
 
Business Process Management JournalBusiness process manageme.docx
Business Process Management JournalBusiness process manageme.docxBusiness Process Management JournalBusiness process manageme.docx
Business Process Management JournalBusiness process manageme.docx
 
Business Process DiagramACCESS for ELL.docx
Business Process DiagramACCESS for ELL.docxBusiness Process DiagramACCESS for ELL.docx
Business Process DiagramACCESS for ELL.docx
 
Business Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docx
Business Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docxBusiness Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docx
Business Plan[Your Name], OwnerPurdue GlobalBUSINESS PLANDate.docx
 
Business PlanCover Page  Name of Project, Contact Info, Da.docx
Business PlanCover Page  Name of Project, Contact Info, Da.docxBusiness PlanCover Page  Name of Project, Contact Info, Da.docx
Business PlanCover Page  Name of Project, Contact Info, Da.docx
 
Business Planning and Program Planning A strategic plan.docx
Business Planning and Program Planning          A strategic plan.docxBusiness Planning and Program Planning          A strategic plan.docx
Business Planning and Program Planning A strategic plan.docx
 
Business Plan In your assigned journal, describe the entity you wil.docx
Business Plan In your assigned journal, describe the entity you wil.docxBusiness Plan In your assigned journal, describe the entity you wil.docx
Business Plan In your assigned journal, describe the entity you wil.docx
 
Business Plan Part IVPart IV of the Business PlanPart IV of .docx
Business Plan Part IVPart IV of the Business PlanPart IV of .docxBusiness Plan Part IVPart IV of the Business PlanPart IV of .docx
Business Plan Part IVPart IV of the Business PlanPart IV of .docx
 
BUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docx
BUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docxBUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docx
BUSINESS PLAN FORMAT          Whether you plan to apply for a bu.docx
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 

19Database SystemsOctober 17, 2016ContentsI..docx

  • 1. 19 Database Systems October 17, 2016 Contents I. Database System Overview 3 1. Context 3 2. Database System Goals and Objectives Statement 4 3. How the proposed Database System addresses the Business Problems? 4 4. How the Proposed Systems aligns to the Mission Statement and Strategic Goals of the Organization? 5 5. Mission and Goals of the Retail Store 6 6. Conclusion 7 II. Entity Relationship Model 8 1. Relational Database Proposal for online Retail Shop 8 2. ER Model and Relational Model 9 3. Converting ER Diagram to Relational Model 14 4. ER Tables Normalization 17 III. Structured Query Language (SQL) Scripts 18 IV. Database Administration Plan 19 V. Future Database System Implementation Plan 20 VI. References 21 Database System Overview Database management systems or DBMS is a technology of retrieving and storing users’ data with utmost efficiency and
  • 2. appropriate security measures. The retail store Company is experiencing increased growth in the recent weeks. The customers expressed their interest in purchasing their products electronically. The Company’s website is simple, but it is not clear, if the Company,is in a position, of receiving online purchases. The Company aims at eventually integrating to online purchasingusing the current order entry system. This research project gives a description of the general business environment of the retail store Company. Referencing database objectives, statements, and system goals. Included is a narrative discussing how the proposed DBS addresses the current organization problem. Context Development of the retail store online could provide a lucrative alternative increase in sales by attracting customers, meeting the needs of the organization, and market expansion. However, conducting an online retail store creates some environmental considerations. The general business environment defines the external and internal factors that influence the Company’s operating situation. The business environment includes suppliers, clients, competitors, technology, government activities, and laws.(Elmasri & Navathe, Fundamentals of Fourth Edition Database Systems, 2005) Database System Goals and Objectives Statement Objectives and goals define what the database project will accomplish or the value of the database project to the business. Database designers should keep in mind six aims during the design of any database system. First, provide a mass storage of the relevant data. Second, protect data from unauthorized access. Such as, in the current database system of the retail store, allows promotional, and discountsof products, when not
  • 3. authorized. Third, the database system must aim at allowing growth. Some of the orders in the retail store, is not available, when required. Fourth, data systems should aim at making access of the order, easy access to the users of the system. Fifth, a database system should eliminate redundant data and allow many users to access to the database simultaneously. Sixth, a database system should make the latest modifications to the database available immediately.(Rob & Coronel, 2002) How the proposed Database System addresses the Business Problems? The retail shop scenario explains that the employees rely greatly on paper-based sales and invoices. The Company needs to consider the time that is wasted on tasks that database systems can handle at an instant. The same also, goes to the financial reporting mechanism that is currently being employed by the Company. Currently the retail company takes ages to reconcile and consolidate financial data; a database system can make an important impact. (Elmasri & Navathe, Fundamentals of Fourth Edition Database Systems, 2005) The retail company is growing significantly in the recent months; one of the biggest challenges faced by the retail company is inventory management. Ensuring that the right order is in the right customer at the right time is a vital for the organization operations. In addition, when sales, customer data, and inventory is maintained separately, the current view of the retail store, can create serious problems in the Company. If the Company runs out of a popular product, the sales will be off, until the next shipment arrives. In addition, if a consumer, or a customer, makes an inquiry about their order, and the employees are unable to track, if the order is being shipped, or if it is in the company’s current inventory, the retail company, will develop a bad reputation, for customer service, and reliability. Database systems help in tracking orders and answers, customers’ questions; with ease and gives the exact
  • 4. shipping status of the order. (Elmasri & Navathe, Fundamentals of Fourth Edition Database Systems, 2005) How the Proposed Systems aligns to the Mission Statement and Strategic Goals of the Organization? The proposed system defines the components, rules, the roadmap that governsEnterprise Resource Planning (ERP) utilization, and deployment. The proposed system takes into account the mission of the company, the organizational goals, and the strategies of the retail Company. First, the proposed system enables the standardization of the Companies’ process and the use of the best practices. Second, the proposed will provide the necessary information, which is readily available for decision making, for performing individual tasks, and planning. Third, the proposed system will enable data management, better handling of master data, definition of information, and transactional data. In addition, the proposed system, will result the retail company, to be more efficient, positive customer service, governmental compliance, and minimized operational costs.(Dittrich & Geppert, 2001) The prosed system is business intelligence based, this will help in analyzing data, and decision making. The best feature of the proposed system, is that all data and information, is kept by the company, which includes the central repository, or the data is saved, in a single database. This helps in answering all the questions posed by a customer,resulting in delivering,outstanding customer service. In conclusion, the proposed system assists in improved security and availability of data, better information transparency, better harmonization of all the IT infrastructure, high quality of organizational processes, better information quality, and transparency.(Dittrich & Geppert, 2001) Mission and Goals of the Retail Store
  • 5. The mission of the retail store company is to work together and employ current technology in an online database infrastructure, lowering the cost of production of the organization, and achieve an increased profit margin. In order, to full fill this mission the retail shop will work on the unique procedures that have an open door policy, all the managers in the retail company, are open to collaboration of all the employees, at all levels and answering, customers, and supplier questions, on a daily basis. The goals of the retail store company comprise of the following: First, the system should not allow discounts and promotional products. Second, the orders must be available for customers and the customer service platform should be effective. Third, the orders must not be misdirected. Fourth, the current database, must be up to date, with the current stock, and inventory. Fifth, the online platform must include credit processing, discount offers, shipping options, and purchasing. Lastly, the system must provide high security to both the customer’s data and the organization’s sensitive information. (Robinson & Robinson, 2005) Conclusion The proposed systems have revolutionized organizations and Companies around the globe. An example, is Wal-Mart stores have relied heavily on online stores and ERP systems to carry out its daily activities. This has made the company harvest increased profits in recent years. This research project includes discussion of the database system objectives statement and goals. Including the needed goals for the proposed system. In part two, I was able to show how the proposed system will address some of the business problems. In conclusion,analysis of how the proposed system aligns the strategic goals of the organization and identification of the mission and the goals of the organization. With these four parts, a description of a general business environment for the presented case study. Entity Relationship Model
  • 6. Relational Database Proposal for online Retail Shop The retail company will offer products online because of customer demand. The company has faced many challenges in the recent past which have made operations very inefficient. The current system in use has no documentation which does show a system blueprint for errors, corrections, or even any attempts, to improve the system. Customer orders get lost, products in the inventoryare out of stock, and customer tracking is often difficult. Also,customers are often awarded promotional goods and discounts undeservingly. There is a need to install controls to curb this abuse of the system. The proposed database system will ensure all organizational operations is accomplishedefficiently. ER Model and Relational Model The diagram below presents a recommended relational database that the company should use. The design takes into account the challenges of the retail store. Figure 1: ER Diagram Entity-Relationship model is a high-level description of thedata model. It is utilized extensively in conceptual designing of relational schema databases. The requirements of a database developed are usually laid down in a top-down structure.(Elmasri & Navathe, Data Modeling Using the Entity Relationship (ER) Model, 2011) ER diagrams are the diagrams drawn using the standard. Entities
  • 7. are represented as points, or polygons, and relationships are shown using lines that connect entities. From an ER diagram, it is easy to obtain a relational table, aiding in optimizing designs, and in debugging systems. From the case scenario, various entities were identified that need implementation,in reference to problems faced within the current system. (Teory, 2011) These entities are as follows: 1. Customer – this entity refers to anyone who makes an order on the company’s website. Roles of a customer include checking out products through theorder. This entity relates to order and discount relations as every customer makes an order. A client must at least make an order in a view to qualify for thediscount. This is a control measure put in place to curb unwarranted discounts to undeserving clients.(Teory, 2011) 2. Order – it represents a single transaction when a customer purchases items. This order relates to the store, by checking the availability of the product in question.(Teory, 2011) 3. Product - represents individual item that the company offers to its customers. 4. Inventory – represents different types of reports generated in combination with other entities. These reports include cost of stocks, inventory per items, inventory total’s, amongst other many reports.(Teory, 2011) 5. Store – this is the actual storage place where products are stored and customers can get them from. 6. Employee –this is an entity that represents a person that supervises all operations of the online store. Employee entity relates to many other tables like the approving discounts on discount relation, processing orders, etc. 7. Discounts – this is an entity for providing an extra service or product to the customer. 8. Constraints – different types of constraints that have to be implemented to ensure optimum performance of the database. (Teory, 2011) Entity integrity constraintsensures that the primary key field cannot be NULL. It is because a primary key field, is used to
  • 8. uniquely,to identify a record, and having no value, in this field, means that we cannot identify, some tuples in a relation. (Elmasri & Navathe, Data Modeling Using the Entity Relationship (ER) Model, 2011) We also, have the primary and unique key constraint. It is a norm, to have an attribute that identifies, every entity in a table. Such an attribute is referred to as akey attribute. In some instances, more than one attribute may be used to form the key attribute. When this happens, we refer to the key as composite. This key needs to be minimal as much as possible, but has to contain all attributes that will express, theexplicit uniqueness of an entity.(Elmasri & Navathe, Data Modeling Using the Entity Relationship (ER) Model, 2011) According to Graves,referential integrity constraint is used, whenever, there are two relations, and its prime purpose, is to uphold consistency, in the tuples, of the relating tables. It is basically defined, as a tuple in one relation that relating to a tuple, in another relation. It just means, having a foreign key, which references a primary key, in another relation.(Graves, 2002) Finally, there are check constraints, which help define, the valid data, whenever, we are adding, or updating data, in a relational database. A check constraint, must be a predicate, and has to be applied, in each tuple. It must be able to refer either to a single or many columns of a relation. The output we get from check constraint, is either TRUE, FALSE or even UNKNOWN. The outcome is dependent on the NULL values present in a tuple. (Graves, 2002) The last set of constraints we need to use are the business rules. These are the constraints that we cannot express directly in data models but have to be enforced by application programs. (Silverston, 2013) Some of those rules which must be implemented are as follows:A customer must place one order with a view to qualify
  • 9. for a discount or promotional product.One and only one product belongs to one category.Aclient can make many orders.An order can have more than one discount since each order has many products.One employee can process many orders.One or many employees can manage many stores.Each customer discount can have many products.Only one employee can serve one customer, with many discounts; since a customer can place an order with many products.Only one product entry is found in an inventory. (Silverston, 2013) Looking at the diagrammatic representation above, we have tried to represent these rules on every table relation, even though each, and every one, has to be implemented,at the application level. Converting ER Diagram to Relational Model A good ER diagram allows us to derive relational tables efficiently. From the ER above, this section presents detailed models of the tables including the data types, description of each field, and their relationships. Customers table Field Description CustomerId[PK] Integer value and auto generated FirstName 128-letter character string SecondName PhoneNo 10-digit character string ranging from 0 to 9 Email 128-letter character string City
  • 10. 50 character string ranging from A to Z Candidate keys: FirstName, econdName, PhoneNo, Email, Employee Table Field Description EmployeeId[PK] Integer value and auto generated EmployeeName 128-letter character string Position 50-letter character string SSN character string ranging from 0 to 9 PhoneNo 10-digit character string ranging from 0 to 9 Email 128-letter character string City 50 character string ranging from A to Z Order Field Description OrderId Primary key Auto-generated integer EmployeeId[FK] Integer value referencing employees table CustomerID [FK] Integer value referencing Customers table ProductId Integer value referencing products table Orderdate Date over which order was made Quantity Integer digit describing number of items bought TotalCost
  • 11. Double number with a two digit precision(Currency) City 50 character string ranging from A to Z Candidate keys are:OrderId, CustomerId, productId Filed to index is OrderId Product Table Field Description Id Primary key Auto-generated integer for identifying the product Name 128-letter character string categoryId Integer value referencing product Category table Price Double digit number with precision of two digits Description 1000-letter character string describing each product Inventory table Field Description InventoryId Primary key Auto-generated integer EmployeeId Integer foreign key to employees table StoreId Integer foreign key referencing Stores table ProductId Integer foreign key referencing products table Quantity Integer digit describing number of items in stock Description 1000-letter character string describing each product Candidate keys are:StoreID, ProductID Filed to index is: StoreID, ProductID
  • 12. Discount table Field Description DiscountID Primary key Auto-generated integer value CustomerId Integer foreign key to Customers table EmployeeID Integer foreign key to employees table OrderId Integer foreign key referencing orders table Description 1000-letter character string describing each Discount Category table Field Description CategoryId Primary key Auto-generated integer value CategoryName 128-letter character string Description 1000-letter character string describing each Discount Store Table Field Description StoreId Primary key Auto-generated integer value StoreName 128-letter character string Candidate key:StoreId Field to index:StoreId
  • 13. ER Tables Normalization Normalization is a process that is usually used to ensure database design achieves minimal data redundancy and providing sensible data dependencies. The databaseis associated with operations like insertion, deletion, updating. Without proper normalization, these tasksbecome difficult to perform and may lead to data loss at times. And when not the case, the database becomes very redundant. Harrington and Harrington, explains how normalization is achieved using the forms; 1NF, 2NF, 4NF and the 4NF. (Harrington, 2009) To satisfy 1NF form, duplicative columns must be eliminated on a table. In a case where there are such repeating columns, then the table is broken down, into two, so that each column,can hold, an atomic value. The rows must have unique columns. Looking at our design of the retail store database, all the tables satisfies this condition. For example, if we look at the product table in the diagram ERabove, all the fields are dependent on the primary key field, Id. If we try to add two or three rows of data to our table, we will realize that there is not duplication. We can, therefore, say that our design satisfies 1NF of normalization forms. The 2NF forms require that a database must meet 1NF conditions and then all the subsets of multiple rows be removed, and placed on separate tables. In the 3NF, all fields that do not depend on the primary key field are removed to form new table. The above design has satisfied all these conditions. For instance, there are relationships defined, for each table, as well as, the keys relating them. (Silverston, 2013)Structured Query Language (SQL) Scripts Database Administration Plan Future Database System Implementation Plan
  • 14. References CustomerProductInventoryOrderEmployeeStoreDiscountsProduc tCategorycustomer_id(Int)PKFirst Name(string)SecondName(string)emai l(String)PhoneNo (string)City (string)Name (string)CategoryIdPrice(Currency)Description (string)InventoryId(int)PKProductId (Int)FKQuantity(int)StoreId (int)FKOrderId (Int)PKProductId (int)FKCustomerId (Int)FKOrderDate (Date)Quantity (Int)TotalCost (Currency)Name (string)Position (string)SSN(Int)PhoneNo((string))StoreID (Int)PKAddress (string)ManagesEmployeeId (Int)FKServesDiscountId (Int)PKCustomerId (Int)FKDescription (string)EmployeeId (int)FKCategoryName(String)CategoryId [int]PKBelongs toDescription(String)PKOrderIdFKGives Discounts/ Promotional ProductsEmail (String)EmployeeIdFKEmployeeIdPKIdPK Customer Product Inventory Order Employee Store Discounts ProductCategory customer_id(Int) int FK PK First Name(string) int FK PK SecondName(string)
  • 15. int FK PK emai l(String) int FK PK PhoneNo (string) int FK PK City (string) int FK PK Name (string) int FK PK CategoryId int FK PK Price(Currency) int FK PK Description (string) int FK PK InventoryId(int) int FK PK ProductId (Int)
  • 16. int FK PK Quantity(int) int FK PK StoreId (int) int FK PK OrderId (Int) int FK PK ProductId (int) int FK PK CustomerId (Int) int FK PK OrderDate (Date) int FK PK Quantity (Int) int FK PK TotalCost (Currency) int FK PK Name (string)
  • 18. Serves M1 M2 M3 M4 DiscountId (Int) int FK PK CustomerId (Int) int FK PK Description (string) int FK PK M1 M2 M3 M4 M1 M2 M3 M4 EmployeeId (int) int FK PK M1 M2 M3 M4
  • 21. USE storemanager GO --CHECK TO SEE IF TABLE EXISTS AND IF SO, DROP AND RECREATE TABLE IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME = 'Crosstab') DROP TABLE Crosstab GO --CREATE TABLE FOR DEMONSTRATION PURPOSES CREATE TABLE Crosstab ( Year SMALLINT, Quarter TINYINT, Amount DECIMAL(2,1) ) GO
  • 22. INSERT INTO Crosstab VALUES (2010, 1, 1.1) INSERT INTO Crosstab VALUES (2010, 2, 1.2) INSERT INTO Crosstab VALUES (2010, 3, 1.3) INSERT INTO Crosstab VALUES (2010, 4, 1.4) INSERT INTO Crosstab VALUES (2011, 1, 2.1) INSERT INTO Crosstab VALUES (2011, 2, 2.2) INSERT INTO Crosstab VALUES (2011, 3, 2.3) INSERT INTO Crosstab VALUES (2011, 4, 2.4) GO --SELECT the SUM of each quarter, grouped by year: SELECT Year, SUM(CASE Quarter WHEN 1 THEN Amount ELSE 0 END) AS Q1, SUM(CASE Quarter WHEN 2 THEN Amount ELSE 0 END) AS Q2, SUM(CASE Quarter WHEN 3 THEN Amount ELSE 0 END)
  • 23. AS Q3, SUM(CASE Quarter WHEN 4 THEN Amount ELSE 0 END) AS Q4 FROM storemanager.dbo.Crosstab GROUP BY Year GO U3_Worked_Examples/DDL.pdf 1C:UsersMarcelloDropboxCourse ...Course MaterialsWorked ExamplesDDL.sql USE master GO --CHECK TO SEE IF DATABASE EXISTS AND IF SO, DROP AND RECREATE DATABASE IF EXISTS(SELECT name FROM sys.databases WHERE name = 'storemanager') DROP DATABASE storemanager GO CREATE DATABASE [storemanager] GO --SWITCH TO DATABASE USE storemanager --CREATE TABLES CREATE TABLE tblStores ( StoreID char(10) NOT NULL PRIMARY KEY,
  • 24. StoreName varchar(25) NOT NULL, StoreAddress1 char(35), StoreAddress2 char(35), StoreCity varchar(20), StoreState char(2), StoreZip char(10) ) CREATE TABLE tblDepartments ( DeptID char(10) NOT NULL PRIMARY KEY, DeptName varchar(20) NOT NULL, StoreID char(10) FOREIGN KEY REFERENCES tblStores(StoreID) ) U3_Worked_Examples/DDL.sql USE master GO --CHECK TO SEE IF DATABASE EXISTS AND IF SO, DROP AND RECREATE DATABASE IF EXISTS(SELECT name FROM sys.databases WHERE name = 'storemanager') DROP DATABASE storemanager GO
  • 25. CREATE DATABASE [storemanager] GO --SWITCH TO DATABASE USE storemanager --CREATE TABLES CREATE TABLE tblStores ( StoreID char(10) NOT NULL PRIMARY KEY, StoreName varchar(25) NOT NULL, StoreAddress1 char(35), StoreAddress2 char(35), StoreCity varchar(20), StoreState char(2), StoreZip char(10) )
  • 26. CREATE TABLE tblDepartments ( DeptID char(10) NOT NULL PRIMARY KEY, DeptName varchar(20) NOT NULL, StoreID char(10) FOREIGN KEY REFERENCES tblStores(StoreID) ) U3_Worked_Examples/DELETE UPDATE SQL.pdf 1C:UsersMarcelloDropboxCourse ...MaterialsWorked ExamplesDELETE UPDATE.sql --switch to the correct database USE storemanager GO --update store city in tblstores based on StoreID UPDATE tblStores SET StoreCity = 'Hampton' WHERE StoreID = '1005' --To delete a parent record in which there is one or more related child records, the child records --must be deleted first before the parent --delete department associated with store that needs to be deleted from tblstores based on
  • 27. StoreID BEGIN TRAN DELETE FROM tblDepartments where StoreID = '1000' COMMIT TRAN; --delete store from tblstores based on StoreID (USING A TRANSACTION WITH ERROR HANDLER) BEGIN TRAN DELETE FROM tblStores where StoreID = '1001' IF (@@ERROR <> 0) BEGIN PRINT 'Unexpected error occurred!' ROLLBACK TRAN END COMMIT TRAN U3_Worked_Examples/DELETE UPDATE.sql --switch to the correct database USE storemanager GO --update store city in tblstores based on StoreID UPDATE tblStores SET StoreCity = 'Hampton' WHERE StoreID = '1005'
  • 28. --To delete a parent record in which there is one or more related child records, the child records --must be deleted first before the parent --delete department associated with store that needs to be deleted from tblstores based on StoreID BEGIN TRAN DELETE FROM tblDepartments where StoreID = '1000' COMMIT TRAN; --delete store from tblstores based on StoreID (USING A TRANSACTION WITH ERROR HANDLER) BEGIN TRAN DELETE FROM tblStores where StoreID = '1001'
  • 29. IF (@@ERROR <> 0) BEGIN PRINT 'Unexpected error occurred!' ROLLBACK TRAN END COMMIT TRAN U3_Worked_Examples/DML.pdf 1C:UsersMarcelloDropboxCourse ...Course MaterialsWorked ExamplesDML.sql --SWITCH TO DATABASE USE storemanager --INSERT RECORDS IN THE CORRECT ORDER, BASED ON DEPENDENCIES (PARENT BEFORE CHILD)
  • 30. INSERT INTO tblStores VALUES ('1000','ABC Company', '100 Main Street', '', 'Clinton','NJ','08809') INSERT INTO tblStores VALUES ('1001','XYZ Company', '8 Oak Street', '', 'Hampton','NJ','08827') INSERT INTO tblStores VALUES ('1002','John West Ltd.', '110 Main Street', '', 'Clinton','NJ','08809') INSERT INTO tblStores VALUES ('1003','Jacobs Store', '52 Lexal Ave.', '', 'Loch Sheldrake','NY','12759') INSERT INTO tblStores VALUES ('1004','Harris Store', '10 South Blvd.', '', 'Newburgh','NY','12437') INSERT INTO tblStores VALUES ('1005','Johnson Company', '50 Main Street', '', 'Clinton','NJ','08809') INSERT INTO tblDepartments VALUES ('10','Accounting', '1000') INSERT INTO tblDepartments VALUES ('11','Human Resources', '1000') INSERT INTO tblDepartments VALUES ('12','Shipping', '1001') INSERT INTO tblDepartments VALUES ('13','Accounting', '1002') INSERT INTO tblDepartments VALUES ('14','Human Resources', '1003') INSERT INTO tblDepartments VALUES ('15','Shipping', '1004') U3_Worked_Examples/DML.sql
  • 31. --SWITCH TO DATABASE USE storemanager --INSERT RECORDS IN THE CORRECT ORDER, BASED ON DEPENDENCIES (PARENT BEFORE CHILD) INSERT INTO tblStores VALUES ('1000','ABC Company', '100 Main Street', '', 'Clinton','NJ','08809') INSERT INTO tblStores VALUES ('1001','XYZ Company', '8 Oak Street', '', 'Hampton','NJ','08827') INSERT INTO tblStores VALUES ('1002','John West Ltd.', '110 Main Street', '', 'Clinton','NJ','08809') INSERT INTO tblStores VALUES ('1003','Jacobs Store', '52 Lexal Ave.', '', 'Loch Sheldrake','NY','12759') INSERT INTO tblStores VALUES ('1004','Harris Store', '10 South Blvd.', '', 'Newburgh','NY','12437')
  • 32. INSERT INTO tblStores VALUES ('1005','Johnson Company', '50 Main Street', '', 'Clinton','NJ','08809') INSERT INTO tblDepartments VALUES ('10','Accounting', '1000') INSERT INTO tblDepartments VALUES ('11','Human Resources', '1000') INSERT INTO tblDepartments VALUES ('12','Shipping', '1001') INSERT INTO tblDepartments VALUES ('13','Accounting', '1002') INSERT INTO tblDepartments VALUES ('14','Human Resources', '1003') INSERT INTO tblDepartments VALUES ('15','Shipping', '1004') U3_Worked_Examples/REPORT SELECT.pdf 1C:UsersMarcelloDropboxCourse ...Worked ExamplesREPORT SELECT.sql
  • 33. 1 2 USE storemanager 3 4 --SELECT ALL STORES AND THEIR RELATED DEPARTMENTS 5 SELECT tblStores.storeID, StoreName, DeptName 6 FROM tblStores 7 INNER JOIN tblDepartments 8 on tblStores.storeID = tblDepartments.storeID 9 10 --SELECT A STORE AND ITS RELATED DEPARTMENTS 11 SELECT tblStores.storeID, StoreName, DeptName 12 FROM tblStores 13 INNER JOIN tblDepartments 14 on tblStores.storeID = tblDepartments.storeID 15 WHERE tblStores.StoreName = 'ABC Company' 16 17 --AGGREGATE QUERY SHOWING TOTAL COUNT OF DEPARTMENTS PER STORE 18 19 SELECT StoreID, COUNT(DeptID) as "Number of Departments" 20 FROM tblDepartments 21 GROUP BY StoreID 22 23 U3_Worked_Examples/Thumbs.db COMPANY SCENARIO A retail store wants to offer its products online in response to numerous customers requesting to be able to purchase the
  • 34. company’s products electronically. The company is beginning to see some growth in spite of the recent economic downturn. The company strives to meet the needs of its customers, including giving them the perception that they are the company’s highest priority. Being a profitable operation has not always been the case, and the company has historically struggled with customer service issues, inventory-management problems, employee turnover, and poor productivity overall. Naturally, the stakeholders of the company began to lose faith in the viability of the company, and unfortunately, numerous stakeholders have dissolved their relationship with the retail store entirely. Approximately 7 years ago, the company hired a freelance information technology (IT) organization to create a data-driven information system that would support customer records and order entry. The store manager convinced the owner of the company that this route was the way to go. After all, anything would be an improvement over what the company had at the time. The owner felt that because it was important to have an efficient way to track customers and orders, any computerized system would be sufficient. He was not too proud to share his lack of technological skills, and often deferred to others when it came to making decisions in this area. He often joked that perhaps some computer training would do him and his employees some good. He was never really assured that his data were backed up correctly or that his system was secure. And what if the system crashed or the data started to appear unusual? He also had never heard of any of his employees backing up the system files. If he lost all of his data, he would not know where to turn or what to do. The very idea of his business depending so much on technology was almost too stressful to think about. Deep down, however, he really wanted some assurance that his information was reliable and secure. The customer records and order entry system that was installed solved a few problems for the short term but quickly proved to lack the capability to meet the goals, objectives, and overall data needs of the company. The freelance technology company
  • 35. provided no documentation on how to use the system or even how it was designed. A large component that was missing was having the ability to track the product inventory. The system in its current state does not seem to be fully functional and often lets employees override the store procedures that the owner has clearly stated should be adhered to. For example, customers are given discounts when they are not eligible, certain products are completely depleted from inventory without being flagged for reorder, and prospects who have never placed an order are set up as customers with a fake order to give them free product samples and promotional materials. This usually involves a person who is friends with an employee collaborating to set up fake order for a product that is not even real. Although the owner does not feel that he is very technically proficient, he admits that perhaps he should have researched the needs of his company and the possible options before jumping on the first opportunity that presented itself. He knows that he reacted to the problem instead of responding in an effective manner. After all of that trouble, employees cannot keep track of customer records, orders get misplaced on the system, and products that are not in inventory keep coming up as available. The problem has gotten so bad that the owner has directed all employees to resort back to the manual method to handle all daily business transactions. At this point in the company’s history, the need for positive changes is apparent to the owner. He is committed to his company and his customers. He values all of the input that stakeholders have provided to him over the years and knows that with a little determination, the company can be a success. His employees are loyal to him and appreciate his attentiveness to their needs and concerns. He knows that each employee is good at solving problems and wants to able to reward all of them by recognizing when they are able to solve problems for the company. He sees his employees as dedicated and capable of meeting any of the goals and objectives that he sets for them. He often compliments them on the cleanliness of the store and
  • 36. the way that the shelves are organized. He has told them that the company takes pride in its appearance and ability to greet the customer with a smile. This includes having the products that the customer wants at a reasonable price; that is what he calls customer service. Perspectives: Kelly, Customer Service Representative “Every time customers call me and want to know the status of their order, I feel like it takes forever for the system to provide a simple answer to a simple question. I can understand why customers get frustrated with us because all they want is to know what is going on with their order. After all, they are trying to coordinate their busy lives and such. I feel like an idiot when I cannot answer the customer right away, and I am upset because I thought this system would make things better. I feel like I spend more time listening to customers complain, and it makes me uncomfortable.” Mark, Cashier “I don’t understand why I can’t simply give the customers a break sometimes. I know they should not get a discount all the time, but if I know them, I think it is good customer service to make them happy. Plus, the system allows me to do it. If this was such a bad thing, then the system should not allow me to give discounts and promotional products when I am not supposed to.” Sandy, Product Manager “This new system was supposed to help me manage product inventory more efficiently but it isn’t. I do not have time to go back into the warehouse and count everything. I told customers that we had plenty of stock, and we actually had none in the warehouse, so naturally the customers are really angry with me. But it is not my fault. The system told a different story, and I relied on the system to be right. Now the owner is mad at me because he thinks I am not capable of doing my job. He says I should always check to make sure that the system is not lying, but I don’t have the time to do this!”
  • 37. Ralph, Store Manager “I really thought a new system was the way to go; after all, technology is supposed to solve all problems, right? Why can’t things just work? The owner is really upset because we spend so much time trying to fix problems that occur on a daily basis that we do not have time to make things better in the store. At this point, we will never be able to sell our products online. We cannot even manage the store we have! Orders get misplaced, customers are angry because the wrong products come in on their orders, and I am really tired. I just don’t understand it. I have seen technology actually help businesses run more smoothly. Why does technology not work for us?” Ellen, Customer "I love the convenience of shopping online. With my busy lifestyle, I have no time to go shopping at the store for what I need. I do appreciate being treated with respect as a customer too. After all, I should get the product I want at a fair price and should have the ability to choose from a wide selection. I love the websites that have customer support options so that I can call if I have a problem. I will be honest, however, that I have little patience for order mix-ups and things like that. A company that sticks by its word, though, means a lot to me. We all make mistakes; it's how we fix those mistakes that matters."