Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Book I got these out of: MYSQL murach Enter and run your own SELECT statements In these exercises, you ll enter and run your own
Book I got these out of: MYSQL murach
Enter and run your own SELECT statements In these exercises, youll enter and run your own SELECT statements. To do that, you can open the script for an example that is similar to the statement you need to write, copy the statement into a new SQL tab, and modify the statement. That can save you both time and syntax errors.
Write a SELECT statement that returns three columns from the Vendors table: vendorname, vendorcontactlastname, and vendorcontactfirstname. Then, run this statement to make sure it works correctly. Add an ORDER BY clause to this statement that sorts the result set by last name and then first name, both in ascending sequence. Then, run this statement again to make sure it works correctly. This is a good way to build and test a statement, one clause at a time.
Write a SELECT statement that returns one column from the Vendors table named fullname that joins the vendorcontactlastname and vendorcontactfirstname columns. Format this column with the last name, a comma, a space, and the first name like this:
Doe, John
Sort the result set by last name and then first name in ascending sequence. Return only the contacts whose last name begins with the letter A B C or E This should retrieve rows.
Write a SELECT statement that returns these column names and data from the Invoices table:
Due Date The invoiceduedate
Invoice Total The invoicetotal column
of the value of invoicetotal
Plus The value of invoicetotal plus
Return only the rows with an invoice total thats greater than or equal to and less than or equal to This should retrieve rows. Sort the result set in descending sequence by invoiceduedate.
Write a SELECT statement that returns these columns from the Invoices table:
invoicenumber The invoicenumber column
invoicetotal The invoicetotal column
paymentcredittotal Sum of the paymenttotal and credittotal columns
balancedue The invoicetotal column minus the paymenttotal and credittotal columns
Return only invoices that have a balance due thats greater than $ Sort the result set by balance due in descending sequence. Use the LIMIT clause so the result set contains only the rows with the largest balances.
I am having trouble with these exercises, I have done the though.
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