Please written by computer source 11 1. (Use AP) Write a SELECT statement that returns six columns from three tables, all using alias names: VendorName column named Vendor, InvoiceDate column named Date of Invoice (include the spaces), InvoiceNumber column named Number, InvoiceSequence column named #, InvoiceLineItemAmount column named Line Item Amount (include the spaces), and Tax (which is the line item amount multiplied by 6%). Also, assign the following table alias names to the tables: Vendors table named v, Invoices table named i, InvoiceLineItems table named ili. List only data for the Line Item Amounts greater than or equal to $50 but less than $1200 and Vendornames that begin with C-D or K-S. Sort the final result set by Vendor name ascending, and Line Item Amount descending,. 2. (Use AP) Create a query listing all of the vendors (show only vendorid, vendorname) from the state of Wisconsin (WI) or New Jersey (NJ) or Pennsylvania (PA) who have never been invoiced (they do not have an invoice associated with them). Sort the final result set by vendorname from Z-A. 3. (Use Sally’s Pet Store) Sally wants an inventory report that lists all of the inventory the store has ever carried (both animals and merchandise). Use the UNION operator to generate the result set consisting of five columns. The first column (called ID) should be the ID of the animal or item. The second column (called Description) should be the description of the item or a concatenation of category and breed (with a space dash space in between such as ‘Cat - Siamese’) for animals. The third column (called LPrice) should list the listprice of the animal or item. The fourth column (called Type) should be a text tag of “Animal” for animals and “Merch” for merchandise items. Sort the final result set by listprice descending. 4. (Use Sally’s Pet Store)Sally has a very fickle customer that would like to see if the store has ever carried certain types of animals. Write one query to answer this question: List the parrots or parakeets or lovebirds that have blue or red but not gold as part of their color, and also list the female registered cats with a price from 130 to 300 born in June, July or August of the year 2004, but not black cats. Return all columns in the animal table, and sort the result set by listprice with the largest value first. 5. Write the code to create 3 tables: SALESAGENT, AGENTAUTO, and AUTOMOBILE. The SaleAgent table should have a surrogate key named SID with automatic sequential numbering, and these fields (SFN variable text max of 30 and required, SLN with an appropriate data type, SPhone with an appropriate data type). AUTOMOBILE should have field named VIN which is a unique number that comes on every car and should be used as the primary key. The table AGENTAUTO table should have the fields startdate and enddate with appropriate data types, a primary key of your choosing, and the necessary two foreign keys with referential integrity constraints enforced.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter12: Database Queries With Sql
Section: Chapter Questions
Problem 1E
icon
Related questions
Question

Please written by computer source

11

1. (Use AP) Write a SELECT statement that returns six columns from three tables, all using alias names: VendorName column named Vendor, InvoiceDate column named Date of Invoice (include the spaces), InvoiceNumber column named Number, InvoiceSequence column named #, InvoiceLineItemAmount column named Line Item Amount (include the spaces), and Tax (which is the line item amount multiplied by 6%). Also, assign the following table alias names to the tables: Vendors table named v, Invoices table named i, InvoiceLineItems table named ili. List only data for the Line Item Amounts greater than or equal to $50 but less than $1200 and Vendornames that begin with C-D or K-S. Sort the final result set by Vendor name ascending, and Line Item Amount descending,.

2. (Use AP) Create a query listing all of the vendors (show only vendorid, vendorname) from the state of Wisconsin (WI) or New Jersey (NJ) or Pennsylvania (PA) who have never been invoiced (they do not have an invoice associated with them). Sort the final result set by vendorname from Z-A.

3. (Use Sally’s Pet Store) Sally wants an inventory report that lists all of the inventory the store has ever carried (both animals and merchandise). Use the UNION operator to generate the result set consisting of five columns. The first column (called ID) should be the ID of the animal or item. The second column (called Description) should be the description of the item or a concatenation of category and breed (with a space dash space in between such as ‘Cat - Siamese’) for animals. The third column (called LPrice) should list the listprice of the animal or item. The fourth column (called Type) should be a text tag of “Animal” for animals and “Merch” for merchandise items. Sort the final result set by listprice descending.

4. (Use Sally’s Pet Store)Sally has a very fickle customer that would like to see if the store has ever carried certain types of animals. Write one query to answer this question: List the parrots or parakeets or lovebirds that have blue or red but not gold as part of their color, and also list the female registered cats with a price from 130 to 300 born in June, July or August of the year 2004, but not black cats. Return all columns in the animal table, and sort the result set by listprice with the largest value first.

5. Write the code to create 3 tables: SALESAGENT, AGENTAUTO, and AUTOMOBILE. The SaleAgent table should have a surrogate key named SID with automatic sequential numbering, and these fields (SFN variable text max of 30 and required, SLN with an appropriate data type, SPhone with an appropriate data type). AUTOMOBILE should have field named VIN which is a unique number that comes on every car and should be used as the primary key. The table AGENTAUTO table should have the fields startdate and enddate with appropriate data types, a primary key of your choosing, and the necessary two foreign keys with referential integrity constraints enforced.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr