Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
error_outline
This textbook solution is under construction.
Students have asked these similar questions
7.
SELECT name
FROM instructor
WHERE salary = 90000;
This query can be replaced by which of the following ?
a)
SELECT name
FROM instructor
WHERE salary BETWEEN 90000 AND 100000;
b)
SELECT name
FROM employee
WHERE salary =100000;
c)
SELECT name
FROM employee
WHERE salary BETWEEN 90000 AND 100000;
d)
SELECT name
FROM instructor
WHERE salary BETWEEN 100000 AND 90000;
Which query identifies customers living in the same state as the customer namedLeila Smith?a. SELECT customer# FROM customersWHERE state = (SELECT state FROM customersWHERE lastname = 'SMITH');b. SELECT customer# FROM customersWHERE state = (SELECT state FROM customersWHERE lastname = 'SMITH'OR firstname = 'LEILA');c. SELECT customer# FROM customersWHERE state = (SELECT state FROM customersWHERE lastname = 'SMITH'AND firstname = 'LEILA'ORDER BY customer);d. SELECT customer# FROM customersWHERE state = (SELECT state FROM customersWHERE lastname = 'SMITH'AND firstname = 'LEILA');
Which of the following queries identifies other customers who were referred to JustLee Books by the same person who referred Jorge Perez?a. SELECT customer# FROM customersWHERE referred = (SELECT referred FROM customersWHERE firstname = 'JORGE'AND lastname = 'PEREZ');b. SELECT referred FROM customersWHERE (customer#, referred) = (SELECT customer#FROM customers WHERE firstname = 'JORGE'AND lastname = 'PEREZ');c. SELECT referred FROM customersWHERE (customer#, referred) IN (SELECT customer#FROM customers WHERE firstname = 'JORGE'AND lastname = 'PEREZ');d. SELECT customer# FROM customersWHERE customer# = (SELECT customer#FROM customers WHERE firstname = 'JORGE'AND lastname = 'PEREZ');
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
- Which query determines the customers who have ordered the most books from JustLee Books? (refer to the tables in the JustLee Books database.)a. SELECT customer# FROM ordersJOIN orderitems USING(order#)HAVING SUM(quantity) = (SELECTMAX(SUM(quantity)) FROM ordersJOIN orderitems USING(order#)GROUP BY customer#) GROUP BY customer#;b. SELECT customer# FROM ordersJOIN orderitems USING(order#)WHERE SUM(quantity) = (SELECTMAX(SUM(quantity)) FROM orderitemsGROUP BY customer#);c. SELECT customer# FROM ordersWHERE MAX(SUM(quantity)) = (SELECTMAX(SUM(quantity) FROM orderitemsGROUP BY order#);d. SELECT customer# FROM ordersHAVING quantity = (SELECT MAX(SUM(quantity))FROM orderitemsGROUP BY customer#);arrow_forwardBecause the SELECT clause contains the Customer* column, which clause must be included for the query to execute successfully? 1 SELECT customer#, COUNT(*)2 FROM customers JOIN orders USING(customer#)3 WHERE orderdate > '02-APR-09'4 GROUP BY customer#5 HAVING COUNT(*) > 2;arrow_forwardMy resualt has error? SELECT last_name,customer_number2 from CUSTOMERS WHERE REFERRED is not null;SELECT last_name,customer_number*ERROR at line 1:ORA-00904: "CUSTOMER_NUMBER": invalid identifier List all customers who were referred to the bookstore by another customer. List eachcustomer’s last name and the number of the customer who made the referral.arrow_forward
- Display the customer ID, name, and order ID for all customer orders. For those customers who do not have any orders, include them in the display once by showing order ID 0.arrow_forwardA subquery must be placed in the outer query's HAVING clause if: 1.The subquery returns more than one value to the outer query. 2The value returned by the inner query is to be compared to grouped data in the outer query. 3.The inner query needs to reference the value returned to the outer query. 4.None of the above. Subqueries can't be used in the outer query's HAVING clause.arrow_forwardYou need to find out the names of all employees who belong to the same department as the employee 'Jessica Butcher' who is in department 100 and has an employee ID 40. Which of the following queries will be correct? EMPLOYEES Туре NOT NULL NUMBER(4) VARCHAR2(10) Name Null? EMP ID FIRST NAME VARCHAR2(10) VARCHAR2(9) VARCHAR2(4) LAST NAME JOB MGR HIRE DATE DATE SALARY NOT NULL NUMBER COMM PCT NUMBER(7,2) DEPT ID NUMBER(2) DEPARTMENTS Туре NUMBER VARCHAR2(20) VARCHAR2(20) Name Null? DEPT ID DEPT NAME DEPT LOC O SELECT first_name, last_name FROM employees WHERE last_name = 'Butcher' And first_name = 'Jessica'; O SELECT first_name, last_name FROM employees WHERE department =100; O SELECT first_name, last_name FROM employees WHERE department = (SELECT department FROM employees WHERE first_name = 'Jessica' AND last_name = 'Butcher'); O SELECT first_name, last_name FROM employees WHERE department (SELECT department FROM employees WHERE first_name = 'Jessica' AND last_name = 'Butcher' AND…arrow_forward
- 26.In the given query, SPNAME is salesperson name, SPNUM is salesperson number, and CUSTNUM is customer number. SELECT SPNAME FROM SALESPERSON WHERE SPNUM= (SELECT SPNUM FROM CUSTOMER WHERE CUSTNUM=772): What is this subquery determining? A: Which salesperson number is associated with customer number 772 B: Which customer number is associated with 772 salesperson C: Which salesperson number is associated with 772 customers D: which customer number is associated with salesperson number 772arrow_forwardWhich of the following SQL statements displays the all unique job ids from the WORKERS table? A. SELECT job_id FROM WORKERS; C. SELECT DIST job_id FROM WORKERS; B. SELECT DISTINCT (job_id) FROM WORKERS; D. SELECT * FROM WORKERS;arrow_forwardWrite a query that returns all customers listed in the orders table who placed orders on the most recently recorded day, return the OrderID, the CustomerID and the OrderDate .arrow_forward
- Write the SQL code to find the average Assign_Charge by Job_code from the Assignment table. Write the SQL code to find the average Assign_Charge by employee from the Assignment table. Write the SQL code to find who works the most and the least with one’s charging_hour from the Assignment table. Write the SQL code to find how many employees are in job_code 501. Write the SQL code to find what is the job description of job_code 507 Write the SQL codes to find how many projects are available.arrow_forwardQ5: From the Customer table given below write SQL queries for the following question? Write a query to display the record of the last name and city with unique state? Write a query to display the record of the distinct cities of the customers? Write a query to display the records of customers' address whose names contain letter “a”?arrow_forwardWrite a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, you can group the result set by the EmailAddress and OrderID columns. In addition, you must calculate the order total from the columns in the OrderItems table. Write a second SELECT statement that uses the first SELECT statement in its FROM clause. The main query should return two columns: the customer�s email address and the largest order for that customer. To do this, you can group the result set by the EmailAddress column.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
dml in sql with examples; Author: Education 4u;https://www.youtube.com/watch?v=WvOseanUdk4;License: Standard YouTube License, CC-BY