Consider the following set of database tables same tables

Assignment Help Database Management System
Reference no: EM13360832

Consider the following set of database tables (same tables from Assignment 6-1). Please take note of foreign keys (most of them carry the same names as the corresponding primary keys they reference): CUS_CODE in INVOICE, INV_NUMBER & P_CODE in LINE, and V_CODE in PRODUCT. The only exception to the naming convention is the EMP_MGR foreign key in EMPLOYEE which references the EMPLOYEE table in a recursive relationship.

The SQL script file myCompany.SQL (same one from Assignment 6-1) creates the tables below and inserts data into them. You WILL need to rerun the script again for this assignment since the contents of some of the files were altered during assignment 6-1. You should also run the script again before final submission of this assignment. Click HERE if you need the script again.

PS: As a reminder, your SQL statements should be generic enough to produce proper results EVEN if the data inside the database changes. For example, if I ask you to display the products provided by vendors located in TN, you can't manually extract the V_CODE for vendors in TN and use the results to search table PRODUCT for the corresponding products; instead, your query should be written using a join between the two tables or something similar.

I. Part 1: Writing More Complex SQL Queries: Save the SQL code for the following queries a single script file called Part1.sql. In addition, include each query along with its output in your report.

1. Create an SQL query that uses set operations to display the union of the last names in table CUSTOMER and the last names in table EMPLOYEE. Do not include duplicates in the output.

2. Create an SQL query that uses set operations to display the union of the last names in table CUSTOMER and the last names in table EMPLOYEE. This time, include duplicates in the output.

3. Create an SQL query that USES AN UNCORRELATED SUBQUERY1 AND NO JOINS2 to display the descriptions for products provided by a vendor in area code 615.

4. Create an SQL query that USES A CORRELATED SUBQUERY AND NO JOINS to display the descriptions for products provided by a vendor in area code 615.

II. Part 2: Creating and Executing a Stored Procedure: Save the SQL code for this stored procedure in a separate script file called Part2.sql. In addition, include the test steps - see below - along with their output in your report. Finally, answer the question below in your report.

Create an SQL Stored Procedure called prc_inv_delete that takes an invoice number as a parameter and deletes the invoice from table INVOICE. TEST STEPS: To test your procedure, do the following:

a) Run the following two SQL commands: SELECT * from INVOICE WHERE INV_NUMBER IN (1001, 1008); SELECT * from LINE WHERE INV_NUMBER IN (1001, 1008);

b) Execute your procedure to delete invoices 1001 and 1008.

c) Run the same SQL commands again: SELECT * from INVOICE WHERE INV_NUMBER IN (1001, 1008); SELECT * from LINE WHERE INV_NUMBER IN (1001, 1008);

d) Undo all changes made by issuing a rollback command.

Answer this question: Did the corresponding lines for invoices 1001 and 1008 in table LINE get deleted automatically? Can you explain why?

 

Reference no: EM13360832

Questions Cloud

Write a proposal for special need education listening and : write a proposal for special need education listening and pronunciation the proposal is 4 pages should contain a
Using the sentinel controlled while loop develop an : using the sentinel controlled while loop develop an algorithm using pseudocode for computing cosx and sin x for the
Question if the regression line is drawn as y c 1075x : question if the regression line is drawn as y c 1075x when x was 2 and y was 239 given that the intercept was 11.
Case study 2case 2 freedom to burn the qurancarefully read : case study 2case 2 freedom to burn the qurancarefully read the case and craft an essay of about 1000 words in length in
Consider the following set of database tables same tables : consider the following set of database tables same tables from assignment 6-1. please take note of foreign keys most of
The waldorf family was caught in a fire but escaped : the waldorf family was caught in a fire but escaped. unfortunately the father and daughter suffered burns. the father
Title the effective use of mobile technology in health : title the effective use of mobile technology in health caredetailsthis assignment comprises two sections a preliminary
1 john purchases an office building march 15 2013 to us in : 1 john purchases an office building march 15 2013 to us in his computer consulting business.nbsp the price of the
Write on topicnbspenterprise and entrepreneurship choosing : write on topicnbspenterprise and entrepreneurship choosing the right legal structure conducting start up market

Reviews

Write a Review

Database Management System Questions & Answers

  Describe entity-relationship model

Describe the entity-relationship model. How are entities, relationships, and attributes represented in this model? What is a composite entity? Describe the approach to diagrams that uses a crow's foot.

  Show the count of the class after deleting

Will insert any first name, last name, ID, GPA, and phone number, in the proper location in the list sorted alphabetically by last name.  After insertion, you should show the count of the class.  Then print the list after you insert.

  How the approach proposed in the paper is different

Summarise the differences between the ETL process in the paper and that in the scenario.

  What is the key for r

What is the key for R? Decompose R into 2NF, then 3NF relations and what you know about the relation to show that this MD cannot violate 4NF

  Implementation of virtual private databases

Prepare a 3-4 pages of technical document in MS Word Format on usage, utilization, and implementation of Virtual Private Databases (VPD) for the cases of your choice.Explain each situation in details, and describe how it works?

  What is the role of a dbms

What is the role of a DBMS, and what are it advantages? What are its disadvantages?

  Explain new objects based on extending other objects

One of the new classes must be based on a reference extending an existing class from package task02 directly(similar to how Customer extends Person in the sample code).Do not repeat that package task02 class in the task03 package.

  A university library database records

A university library database records information about books; for each book, it records the book isbn number (which is unique), and the book name. In addition, it records which books have been checked out

  Find the decryption function and decipher

Find '(2007), '(2008), and '(b), where b is the integer obtained from the last four digits of your student number.

  Create an xml file with markup tags

Create an XML file with markup tags and some sample data to represent a list of invoices. Include the XML tags for two invoices in the list. Also, assume the invoices are created from a database whose tables are shown in the following database rela..

  Write select statement which returns three columns

Write a SELECT statement which returns three columns: VendorName, InvoiceCount, and InvoiceSum. InvoiceCount is the count of the number of invoices, and InvoiceSum is the sum of the InvoiceTotal column.

  Data analysis and definition

What is the business implications that can be drawn from the process of building and comparing these models, and has this practice helped resolve the business issue? Why or why not?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd