Question: SQL 1. Write a SELECT statement that returns the companyname, address, city and postalcode from the suppliers table where the suppliers ID is also in
SQL
1. Write a SELECT statement that returns the companyname, address, city and postalcode from the suppliers table where the suppliers ID is also in the products table. Order it by the supplier id in descending order.
2. Write a SELECT that returns two columns: the Invoice Number and the Invoice Total. We will have a subquery to obtain the average payment total and return the record when the average is greater than zero. Order the statement by the invoice number.
3. Write a SELECT that returns two columns of productid and unitprice from the products. We will have a subquery using the top 50 percent of the average unitprice. This will be ordered by the unitprice. (The medium marks the midpoint in a set of values; and equal number of values that lie above and below it.
4. Write a SELECT statement that returns the columns of productid and productname. Join products to orders on orderid and productid. Order the result set by productid in descending order.
5. Write a SELECT statement that will return the distinct productid and productname from the products table. Join this to the suppliers table and join on supplierid. Also join the Order Details where the productid is equal. We will obtain the productid from a subquery on order details when the productid is greater than one. Order by productname and productid.
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
