A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 5, Problem 9TD
Program Plan Intro
Subquery:
Any SQL query can be written in the sub query approach.
- The SQL subquery returns one or more column as the result.
- Most SQL systems return a pair wise joining of one and only one column in an inner query with one column of an outer query.
- The data displayed form the table referenced in outer query only.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Find the rep number, last name, and first name of each sales rep who represents at least one customer with a credit limit of $10.000
Show all name and phone numbers of students and the type of donation they received including any unmatched student.table name;StudentDonationVolunteer
Use a subquery to find employees' last names and hire date from the employees table whose manager is named "Hunold".
Chapter 5 Solutions
A Guide to SQL
Ch. 5 - Prob. 1RQCh. 5 - Prob. 2RQCh. 5 - Prob. 3RQCh. 5 - Prob. 4RQCh. 5 - Prob. 5RQCh. 5 - Prob. 6RQCh. 5 - Prob. 7RQCh. 5 - What does it mean for two tables to be union...Ch. 5 - Prob. 9RQCh. 5 - Prob. 10RQ
Ch. 5 - Prob. 11RQCh. 5 - Prob. 12RQCh. 5 - Prob. 13RQCh. 5 - Prob. 14RQCh. 5 - Prob. 15RQCh. 5 - Prob. 1TDCh. 5 - Prob. 2TDCh. 5 - Prob. 3TDCh. 5 - Prob. 4TDCh. 5 - Prob. 5TDCh. 5 - Prob. 6TDCh. 5 - Prob. 7TDCh. 5 - Prob. 8TDCh. 5 - Prob. 9TDCh. 5 - Prob. 10TDCh. 5 - Prob. 11TDCh. 5 - Prob. 12TDCh. 5 - Prob. 13TDCh. 5 - Prob. 14TDCh. 5 - Prob. 15TDCh. 5 - Prob. 16TDCh. 5 - Prob. 17TDCh. 5 - Prob. 18TDCh. 5 - Prob. 20TDCh. 5 - Prob. 21TDCh. 5 - Prob. 1CATCh. 5 - Prob. 2CATCh. 5 - Prob. 3CATCh. 5 - Prob. 4CATCh. 5 - Prob. 5CATCh. 5 - Prob. 6CATCh. 5 - Repeat Exercise 6, but this time use the EXISTS...Ch. 5 - Prob. 8CATCh. 5 - Prob. 9CATCh. 5 - Prob. 10CATCh. 5 - Prob. 11CATCh. 5 - Prob. 12CATCh. 5 - Prob. 13CATCh. 5 - Prob. 14CATCh. 5 - Prob. 15CATCh. 5 - Prob. 16CATCh. 5 - Prob. 17CATCh. 5 - Prob. 18CATCh. 5 - Prob. 1SCGCh. 5 - Prob. 2SCGCh. 5 - Prob. 3SCGCh. 5 - Prob. 4SCGCh. 5 - Repeat Exercise 4, but this time use the EXISTS...Ch. 5 - Prob. 6SCGCh. 5 - Prob. 7SCGCh. 5 - Prob. 8SCGCh. 5 - Prob. 9SCGCh. 5 - Prob. 10SCGCh. 5 - Prob. 11SCGCh. 5 - Prob. 12SCGCh. 5 - Prob. 13SCGCh. 5 - Prob. 14SCGCh. 5 - Prob. 15SCGCh. 5 - Prob. 16SCG
Knowledge Booster
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
- Add the following record to the VACATION_UNIT table: condo ID: 20; location number: 2; unit number: A04; square feet: 1680; bedrooms: 3; bathrooms: 3; condo fee: 775; and owner number: BL720. Display the contents of the VACATION_UNIT table.arrow_forwardList the customer ID and first and last names for all customers located in the city of Cody. Your query should ignore case. For example, a customer with the city Cody should be included, as should customers whose city is CODY, cody, cOdY, and so onarrow_forwardList the owner number and last name for all owners located in the city of Seattle. Your query should ignore case. For example, a customer with the city Seattle should be included, as should customers whose city is SEATTLE, SEAttle, SeAttle, and so on. StayWell is offering a monthly discount for residents who pay their rent on a quarterly basis. The discount is 1.75 percent of the monthly fee. For each property, list the office number, address, owner number, owner’s last name, monthly rent, and discount as DISCOUNT. The discount should be rounded to the nearest dollar.arrow_forward
- SQL: For every invoice, display the invoice number, invoice date and the total dollar amount for all products purchased in the invoice, ordered by invoice number in descending order and then by invoice date in ascending order. Here you will use an aggregate SUM(x,y) function in your SELECT clause to calculate the total dollar amount (a calculated field – name it TOTAL). Don’t forget to join on the tables as well. [hint: you should have 8 rows of output ordered properly]. My code is as follows: select inv_number, inv_date, sum(line_price) as 'total' from invoice, line where invoice.inv_number = line.inv_number order by inv_number desc, inv_date asc ; I am getting this error: ORA-00923: FROM keyword not found where expected Any recommendations on what I am doing wrong?arrow_forwardSQL: For every invoice, display the invoice number, invoice date and the total dollar amount for all products purchased in the invoice, ordered by invoice number in descending order and then by invoice date in ascending order. Here you will use an aggregate SUM(x,y) function in your SELECT clause to calculate the total dollar amount (a calculated field – name it TOTAL). Don’t forget to join on the tables as well. [hint: you should have 8 rows of output ordered properly]. select inv_number, inv_date sum(list_price) as 'total' from invoice, line order by desc inv_num, asc inv_date. I am getting the error: ORA-00923: FROM keyword not found where expected Am I formulating the query incorrectly?arrow_forwardList the balance characteristics of the customers who have made purchases during the current invoice cycle—that is, for the customers who appear in the INVOICE table. The results of this query are shown in Figure P7.37.arrow_forward
- Task 9: Use a subquery to find the sales rep ID, first name, and last name of each sales rep who represents at least one customer with a credit limit of $500. List each sales rep only once in the results. Task 10: Repeat Task 9, but this time do not use a subquery.arrow_forwardFind the service ID and property ID for each service request whose estimated hours is greater than the number of estimated hours of any service request with category number 5. in sql in cengagearrow_forward9. Find the total amount of tax paid by resident of NJ Hint: The tax cost stored in tax_amount column in the orders table The state name stored in state column in the addresses tablearrow_forward
- Select FirstName,LName,start_date from employeetab,Manager where employeetab.manager_id=Manager.managerid group by Department; [please give the explaination of this sql code]arrow_forwardWrite a query to display first name, last name, package number and internet speed for all customers whose package number equals 22 or 27. Order the query in ascending order by last namearrow_forwardList all vendors with their address(city, state,zipcode) for all the vendors who have credited account (credit total>0)) Hint:Vendors & Invoices tables with credit total column WHERE vendors.vendor id = invoices.vendor id AND CREDIT_TOTAL>0; %3Darrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage