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 20TD
Program Plan Intro
“ANY” operator:
The operator “ANY” is used with “WHERE” or “HAVING” clause. If “ANY” operator is used in a subquery, then the condition returns true if it satisfies any of the values produced by the subquery.
Syntax:
SELECT column_Name(s) FROM table_Name WHERE column_Name ANY (SELECT column_Name FROM table_Name WHERE condition);
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Task 4:
The InstantRide User Satisfaction team is a core team for InstantRide, and they focus on increasing the customer satisfaction. They want to learn the travel time for each ride in the system. You need to return the USER_ID, and the TRAVEL_TIME column which is calculated using the TIMEDIFF function on the TRAVEL_END_TIME and the TRAVEL_START_TIME.
Make a list of all of the purchases that were made by the customers, using the output from the command before this one as a point of reference. The results may be sorted according to the invoice number, client code, or product description. You will be required to register for the INVOICE, LINE, and PRODUCT services.
StayWell’s maintenance team wants to recheck the apartments that had plumbing service requests beforehand. You will need to return all the property IDs and the addresses of the properties that had plumbing service request (CATEGORY_NUMBER 1).
Task
Return a list of all the property IDs and the addresses of the properties that had plumbing service requests.
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
- The InstantRide User Satisfaction team received a phone call from a user who might have left her wallet in the car. She indicated that the license plate of the car was starting with BB-883 but unfortunately, she could not remember the full license plate number. The team wants to get all travel information for the cars with the license plate starting with BB-883. You need to return all travel data from the TRAVELS table for the CAR_ID which has a plate number compared with SUBSTR and UPPER functions.arrow_forwardTask 5: The InstantRide User Satisfaction team are looking forward to creating discounts for the users. However, the team suspects that there could be duplicate users in the system with different emails. Check for the users with their names and surnames for potential duplicates. Therefore, you need to JOIN the USERS table with USERS table and compare for equality of USER_FIRST_NAME and USER_LAST_NAME and difference in USER_ID fields. Task: Check for duplicate driver accounts. (SQL Database Test)arrow_forwardTask 4: The InstantRide User Satisfaction team is a core team for InstantRide, and they focus on increasing the customer satisfaction. They want to learn the travel time for each ride in the system. You need to return the USER_ID, and the TRAVEL_TIME column which is calculated using the TIMEDIFF function on the TRAVEL_END_TIME and the TRAVEL_START_TIME.arrow_forward
- Create a list of all of the customers' purchases, using the output from the previous command as a reference. Sort the results by invoice number, customer code, and product description. You'll need to sign up for INVOICE, LINE, and PRODUCT?arrow_forward4. Update the name of the student to "John Doe" where its id is 10. Enter your answer 5. Modify the "student" table by adding "address" column/field as string and allows null.arrow_forwardThe author plans the book chapters and book title. After planning the book author writes the book and send it to the reviewer..The reviewer gives the feedback to the author whether the further changes are required or not. If no changes required, author would send the book in hard and soft form to publishing house. Publishing house will check the book if its according to standard. If yes, then they will send the book for printing otherwise book will be sent to the reviewer for the final revision. The printed book will be sold to customer. The money received by the publishing house will be distributed to reviewer and author From the given problem statements, draw an activity diagram by making sure to have these elements where required Swimlanes Merge and fork nodes Decision nodesarrow_forward
- Refer to the sample tables and sample data below. Then answer questions (a), (b), (c), and (d). Tables: adult (id(pk), name, spouse_id (fk)) -- foreign key (spouse_id) references adult(id) child (id(pk), name) parent_child (parent (pk, fk), child (pk, fk)) -- foreign key (parent) references adult(id) -- foreign key (child) references child(id) mysql> SELECT * FROM adult; id | name 1 Homer Simpson 2 | Marge Simpson 3 Fred Flintstone 4 Wilma Flintstone | mysql> SELECT * FROM child; |id|name 11 Bart 12 Lisa 13 Maggie 14 Pebbles 1 2 | spouse_id mysql> SELECT * FROM parent_child; parent | child | 2 1 2 3 | 41 11 | 11 12 12 13 13 14 14 1 4 How many times will the names Bart and Homer Simpson appear in the result set from the following command? SELECT c.name, a.name FROM child c JOIN parent_child pc ON c.id = pc.child JOIN adult a ON a.id = pc.parent; (a) Bart appears [Select] (b) Homer Simpson appears [Select] times. ✓times.arrow_forwardQ. Write a trigger that checks the length of a contract when a new contract is inserted into longtermcontract table. If this is the first contract between the pharmacy and pharmaceutical company, the length of the contract should not be more than 12 months. If the contract is more than 12 months, the trigger should alter the end date and reduce it to 12 months after the start date. * You have to use BEFORE INSERT ON* THE INSERT STATEMENT IN THE END OF THE GIVEN CODE MUST WORK. GIVEN CODE:-- Do not change the name of the triggerdelimiter //create trigger first_contracts_length_limitation -- do not modify or delete the following lines. Do not write anything after this line.insert into longtermcontract values('parapharmaceutical', '24 South St., Fabreville, QC H7P-E2H', '2020-02-01', '2021-04-01', '***'); SCRIPT:arrow_forward(a) Which command makes updates permanent?(b) Which command reverses updates? (c) Which updates are reversed?arrow_forward
- Create a list of EMPNO, ENAME, HIREDATE, DEPTNO from EMPLOYEE for employee’s with a salary (SAL) greater than 2000. (Note: Do not print out the salary amount!) How many records were printed to the screen?arrow_forwardTask 1: The Finance team wants to calculate a VAT (8%) on the amount of the stay reservations in the database. However, the team wants to calculate the VAT after the discounts are applied on the prices. In addition, it is important to remember if there is no discount/offers, then the value is NULL in the TRAVELS table. Create a procedure called VATCalculator to calculate the VAT amount and return with the corresponding travel ID. In addition, execute the procedure to account for NULL values and send the respective result to the team. The VAT value should be rounded to 2 decimals. Create a procedure to calculate the VAT. 1 Make sure you are using the following format to change the delimiter for the procedure: DELIMITER $$-- statements --END $$DELIMITER ; Test QueryCALL VATCalculator() Expected Results TRAVEL_ID VAT 5001 1.24 5002 1.64 5003 0.99 5004 2.12 5005 0.89 5006 1.05 5007 0.30 5008 1.51 5009 1.08 5010 1.64arrow_forwardTask 1: The Finance team wants to calculate a VAT (8%) on the amount of the stay reservations in the database. However, the team wants to calculate the VAT after the discounts are applied on the prices. In addition, it is important to remember if there is no discount/offers, then the value is NULL in the TRAVELS table. Create a procedure called VATCalculator to calculate the VAT amount and return with the corresponding travel ID. In addition, execute the procedure to account for NULL values and send the respective result to the team. The VAT value should be rounded to 2 decimals. Remember to redefine the MYSQL delimiter (;) when creating the procedure. This will prevent the commands from executing separately. Create a procedure to calculate the VAT. Make sure you are using the following format to change the delimiter for the procedure: DELIMITER $$-- statements --END $$DELIMITER ; Test Query: CALL VATCalculator() Expected Results TRAVEL_ID VAT 5001 1.24 5002 1.64 5003 0.99…arrow_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:CengageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
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
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L