asi1
TRANSCRIPT
-
8/2/2019 Asi1
1/10
Topic: Wine StoreDatabase
*)SystemRequirements:
Before we built the wine store, our client told us what it should do and what features they wanted.
Let's take a look at the scope and aims of the wine store that would typically be gathered from
interviews, studying workflow, and so on.
The wine store sells wines from wineries that are located in regions throughout Australia. The wine
store is open to the public: anonymous users have limited access to the application, and users can
make purchases if they become members.
The wine store carries thousands of wines, and the details of each wine include its name, vintage
(year of release), the winery that makes it, grape varieties, and, in some cases, an expert review of
the wine.
The wine store doesn't do much more than manage members, wines, and ordering. It doesn't have
a reporting module, an administration interface, or any content management features. It is not
designed to be a fully functional application but only to illustrate most of the fundamental
techniques discussed throughout the book.
-
8/2/2019 Asi1
2/10
*) Entities and their attributes:
Wine WineType
Items Inventory Winery Orders Users Customer GrapeVariety
Region Countries Titles
wine id Wine type
id
item id Inventory id
Winery id
Order id User
name
cust id Variety id
Region
id
Country id
Title id
wine
name
wine type qty Cost Winery
name
Date Password first name Variety Region
name
Country Title
Year price date
handed
Credit
card
surname
Descrip
tion
on hand Expiry
date
Birth code
Instructors
addres
city
Zip code
state
phone
-
8/2/2019 Asi1
3/10
*) The Wine Store entity-relationship model (ER model):
This model is derived from the system requirements listed and is derived following the process
described above also includes a description used in the figure.
-
8/2/2019 Asi1
4/10
*) Explanation:
The wine store model can be summarized as follows:
A customer at the online wine store purchases wines by placing one or more orders.
Each customer has exactly one set of user details.
Each customer has a title (such as "Mr." or "Dr") and lives in a country.
Each order contains one or more items.
Each item is a specific quantity of wine at a specific price.
A wine is of a type such as "Red," "White," or "Sparkling."
A wine has a vintage year; if the same wine has two or more vintages from different years, these are treated as two or more
distinct wines.
Each wine is made by one winery.
Each winery is located in one region.
Each wine has one or more grape variety entries. For example, a wine of wine name "Archibald" might be made of the grape
variety entries "Sauvignon" and "Cabernet." The order of the entries is important. For example, a "Cabernet Sauvignon" is
different from a "Sauvignon Cabernet."
Each inventory for a wine represents the on-hand stock of a wine. If a wine is available at two prices, there are two
inventories. Similarly, if the stock arrived at the warehouse at two different times, there are two inventories.
Each wine may have one or more inventories.
-
8/2/2019 Asi1
5/10
*) Wine Store database Relational model:
In this we have mapped our Wine store Entity relationship model (ER model) into relational model
As:
Wine:
Wine id Wine name year Description Wine type
id
---------------
Winery
id
-------------
W1 Apple wine 2012 Country wine Cw1 1
W2 Elderberry
wine
2012 Local wine Fw1 2
W3 Beer 2011 French wine Lw1 3
Wine type:
Wine type id Wine type
Cw1 Country wine
Fw1 French wine
Lw1 Local wine
-
8/2/2019 Asi1
6/10
Items:
Item id qty price Wine id------------
Order id-------------
Itm1 6 45000$ W1 Ord1
Itm2 4 652$ W2 Ord2
Itm3 1 452$ W3 Ord3
Itm4 3 2001$ W4 Ord4
Inventory:
Inventory id Date added cost On hand Wine id
------------
Ivt1 4-06-2011 4500$ 1000$ W1
Ivt2 2-12-2010 6500$ 1000$ W2
Ivt3 6-03-2012 6800$ 1000$ W3
Ivt4 9-02-2012 8540$ 1000$ W4
-
8/2/2019 Asi1
7/10
Winery:
Winery id Winery name Region id
---------------
1 Orlando 1
2 Lindemans 2
3 Penfolds 1
4 Hardy Brothers 1
Orders:
Order id Date Credit card Expiry date Instructors Cust id----------
Ord1 4-06-2011 2398-8162 12-12-2013 Smith Cst1
Ord2 2-12-2010 6510-6258 12-12-2013 John Cst2
Ord3 6-03-2012 0751-3830 12-03-2013 Khan Cst3
Ord4 9-02-2012 3212-8624 12-02-2013 Sami Cst4
Users:
User name Password
Abdullah Qamar *******
John Red ********
Smith Parker *******
Ahmed ibm ********
-
8/2/2019 Asi1
8/10
Customer:
Cust id First
name
Sur
name
addres City zip
code
state phone Birth
code
Country
id
----------
Title
id
--------
User
name
---------
Cst1 Khan Noor Pkr87 Isb 460 Pak 6520 Brt1 Crt1 Tle1 Abdulah
Qamar
Cst2 Raja John Str25 Rwp 382 Pak 3820 Brt2 Crt2 Tle2 John
Red
Cst3 Ali Ibm Krt65 Lbn 850 Eur 46051 Brt3 Crt3 Tle3 Smith
Parker
Cst4 Sami Ms Lrt85 Kgp 142 Afr 56804 Brt4 Crt4 Tle4 Ahmedibm
Grape Variety:
Variety id Variety
Vrd1 Acolon
Vrd2 Aspiran
Vrd3 limnio
Vrd4 Blatina
-
8/2/2019 Asi1
9/10
Region:
Region id Region name
1 Barrosa Valley
2 Yarra Valley
3 Margaret River
Countries:
Country id Country
Crt1 PakistanCrt2 Europe
Crt3 Egypt
Crt4 Libyan
-
8/2/2019 Asi1
10/10
Titles:
Title id Title
Tle1 Red grapes
Tle2 Blue grapes
Tle3 Green grapes
Tle4 Sour grapes
Blending Grape Variety:
Wine id Variety id
W1 Vrd1
W2 Vrd2
W3 Vrd3
W4 Vrd4