Hour 14, "Using Subqueries to Define Unknown Data"

Quiz Answers

1: What is the function of a subquery when used with a SELECT statement?
A1: The main function of a subquery when used with a SELECT statement is to return data that the main query can use to resolve the query.
2: Can you update more than one column when using the UPDATE statement in conjunction with a subquery?
A2: Yes, you can update more than one column using the same UPDATE and subquery statement.
3: Are the following syntaxes correct? If not, what is the correct syntax?
  1. SELECT CUST_ID, CUST_NAME
            FROM CUSTOMER_TBL
            WHERE CUST_ID =
                           (SELECT CUST_ID
                                   FROM ORDERS_TBL
                                   WHERE ORD_NUM = '16C17');
    										
  2.  SELECT EMP_ID, SALARY FROM EMPLOYEE_PAY_TBL WHERE SALARY BETWEEN '20000' AND (SELECT SALARY ...

Get Sams Teach Yourself SQL in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.