Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the simplified partial given ERD ( appendix B ) , analyse the requirements ( appendix A ) and then: a ) Produce a script
Using the simplified partial given ERD appendix B analyse the requirements appendix A and then:
a Produce a script suitable for SQL Developer to create the tables in the ERD appendix B Remember to define a primary and foreign keys where necessary using constraints. Entity definitions are found in appendix CYou will require some numeric data types for certain attributes so that you can comply with the requirement for numeric functions in queries. Examine the data records supplied carefully to identify the numeric attributes. There is an example in appendix CPopulate the tables with the supplied SQL Scripts
b Write SQL statements necessary to satisfy the following queries. Use sensible headings where appropriate.The queries will retrieve data from single and multiple tables, they will use textual and numeric functions as well as creating views.
Queries:
Produce a telephone list for all suppliers. Define a View and include the supplier name and telephone number. Sort by supplier ascending. The final output should only be one column.
Create a query to establish which invoices are over Sort on TOTALVALUE descending.
Create a query to select a particular invoice of your choice. The user should be prompted for the criteria ie INVOICENUMBER should be entered at runtime.
Select...From...Where INVOICENUMBER is INCORRECT
Produce a list of parts for both warehouses. Include BINNUMBER and QUANTITY as well as other suitable attributes. This should be one query. Sort by WAREHOUSEID Use correlation alias names.
Produce a list of parts to find the value of stock by line Qty x Unit Price in the Haverfordwest warehouse. Order by PARTNUMBERWITHPREFIX.
Create a View from your query and then use it to calculate the total value of all stock currently held in the Haverfordwest warehouse. Sort on PARTNUMBER then create another view to calulate the total stock value.
Produce a list of parts that are out of stock in both warehouses.
Produce a list of parts that are available from both warehouses. You will need two queries and a view.
Create a query to find out which parts are cheaper to buy from Sweden, when converted from Swedish Krona to Sterling and rounded to decimal places. Use PARTNUMBERWITHPREFIX, STERLINGNET and your third calculated column. To convert krona to sterling use
Produce a query to increase the cost of all parts by Use PARTNUMBERWITHPREFIX, STERLINGNET and your new price including the Order by the new price.
Appendix A
EuroParts.com is an established company in Wales. It deals with the import and export of car parts. The companys suppliers are based in the UK and Sweden.
EuroParts.com has a warehouse in Haverfordwest and another in Stansted and both hold a stock of parts. Steve is manager of the Haverfordwest branch and Peter manages the Stansted warehouse. Each warehouse has many storage bins comprised of shelves and each shelf will have many plastic part storage containers which are numbered. For simplicity only use the shelf numbers. Part prices are in two currencies, UK sterling, and Swedish krona. All part prices are net of Vat.
a Each warehouse would have a unique set of bins numbers ie bin number AM located in Warehouse ID Steve Haverfordwest would not be found in Warehouse ID Peter Essex
b Some bin shelves location may be empty.
c There will be no requirement for additional warehouses.
d There may be new suppliers.
e There may be new parts.
f The same part may be kept in both warehouses.
g The entity Location is the shelf location on a bin. A bin will have several shelves.
h The part number prefix the first two digits, identifies whether the part is for bodywork, engine, accessory etc.
i The discount code and discount percentage are the markup on the part eg DiscountUKCode of has a DiscountUKPercent of which means profit The net cost of parts is in both UK sterling and Swedish Krona.
j For simplicity the Invoice contains a minimum number of attributes.
There is a M:N relationship between supplier and part but this will not be investigated for the purposes of this system. It can be ignored. There would also be a relationship between supplier and warehouse but this is also outside the remit of this system.Appendix C
Entity DefinitionsAttributes:
Part part number with prefix, part number, description, discount sw code,
discount sw percent, krona net, discount uk code, discount uk percent, sterling
net
Supplier supplier number, supplier name, address, town, county, postcode,
contact number, email address, country
Warehouse warehouse id address, town, county, postcode, contact number
Bin bin number, warehouse id
Location part number with prefix, bin number
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started