Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Learning Activity Two: Retrieving data from a single table Setup [ 1 - 7 ] : Run the create _ ap . sql script to
Learning Activity Two: Retrieving data from a single table
Setup :
Run the createapsql script to create the database
Write a SELECT statement that returns three columns from the Vendors table: VendorContactFName, VendorContactLName, and VendorName. Sort the result set by last name, then by first name.
Write a SELECT statement that returns four columns from the Invoices table, named Number, Total, Credits, and Balance:
Number Column alias for the InvoiceNumber column
Total Column alias for the InvoiceTotal column
Credits Sum of the PaymentTotal and CreditTotal columns
Balance InvoiceTotal minus the sum of PaymentTotal and CreditTotal
Use the AS keyword to assign column aliases.
Write a SELECT statement that returns one column from the Vendors table named Full Name. Create this column from the VendorContactFName and VendorContactLName columns. Format it as follows: last name, comma, first name for example, Doe John Sort the result set by last name, then by first name.
Write a SELECT statement that returns three columns:
InvoiceTotal From the Invoices table
of the value of InvoiceTotal
Plus The value of InvoiceTotal plus
For example, if InvoiceTotal is is and Plus is Only return those rows with a balance due greater than Sort the result set by InvoiceTotal, with the largest invoice first.
Modify the solution to exercise to filter for invoices with an InvoiceTotal thats greater than or equal to $ but less than or equal to $
Modify the solution to exercise to filter for contacts whose last name begins with the letter A B C or E
Write a SELECT statement that determines whether the PaymentDate column of the Invoices table has any invalid values. To be valid, PaymentDate must be a null value if theres a balance due and a nonnull value if theres no balance due. Code a computed column that tests for these conditions.
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