Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
error_outline
This textbook solution is under construction.
Students have asked these similar questions
Which of the following is not a valid SELECT statement?a. SELECT STDDEV(retail)FROM books;b. SELECT AVG(SUM(retail))FROM ordersNATURAL JOIN orderitems NATURAL JOIN booksGROUP BY customer#;c. SELECT order#, TO_CHAR(SUM(retail), '999.99')FROM orderitems JOIN books USING(isbn)GROUP BY order#;d. SELECT title, VARIANCE(retail-cost)FROM booksGROUP BY pubid;
Use the following table to answer the questions below:
Table name: Customers
Column Name
Role
Data Type
Length
Constraint
customerID
stores the ID of a
Char
5
Primary key
customer
custFName
stores the first name of a
Varchar2
35
Cannot be null
customer
custLName
Stores the last name of a
Varchar2
35
Cannot be null
customer
custGender
Store the gender of a
Char
1
It should be M
customer
or 'F'
custDOB
Stores the date of birth of
Date
a customer
custIncome
Store the income of a
Number
customer
a. Write in SQL a command that creates the table Customers according to the above description
b. Write in SQL a statement that adds a new column named accountID of type Char(8). This column should be defined as a foreign key
that relates the table Customers to the table Account
c. Write in SQL a command that deletes the customers whose date of birth is after 22-Dec-1990
d. Write a SQL query that displays the number of customers who born on the 16th day of a month
e. Write in SQL a query that…
Below are some rows of the PROVIDERS table for a factory:
PCODE
NAME
PHONE
10192
Hans, Inc.
231 - 3092
98411
Tools and More
231 - 1029
0489035
Motors Inc.
993 - 1821
All providers from the factory zone of the city start with 231. You want to get the providers that are in the factory zone of the city. Which of the following is more appropriate?
a.
SELECT * FROM PROVIDERS WHERE PHONE LIKE ‘%231%’
b.
SELECT * FROM PROVIDERS WHERE PHONE LIKE ‘% 231’
c.
SELECT * FROM PROVIDERS WHERE PHONE LIKE ‘___ 231 ___’
d.
SELECT * FROM PROVIDERS WHERE PHONE LIKE ‘231%’
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
- Use the following table to answer the questions below: Table name: Customers Column Name Role Data Type Length Constraint customerID stores the ID of a Char 5 Primary key customer custFName stores the first name of a Varchar2 35 Cannot be null customer custLName Stores the last name of a Varchar2 35 Cannot be null customer custGender Store the gender of a Char 1 It should be M customer or 'F' custDOB Stores the date of birth of Date a customer custIncome Store the income of a Number customer d. Write a SQL query that displays the number of customers who born on the 16th day of a month e. Write in SQL a query that displays the ids of the customers who have the highest income f. Create a view named 'customerDetails' to hold all the details of customers whose first names start with 'S' and their incomes are between 500 and 1000 Omani Rialsarrow_forwardWhat is the result of the query below: SELECT V_CODE, COUNT (P_CODE) FROM PRODUCT HAVING V_CODE != 21344; A) A list of V_CODE, and the number of products for each V_CODE that is equal to 21344. B) An error message. C) A list of V_CODE, and the number of products for each V_CODE that is not equal to 21344. D) The number of counts for each P_CODE that has a V_CODE that is not equal to 21344.arrow_forwardUse the following table to answer the question below: Table name: Customers Column Name Role Data Type Length Constraint customerID stores the ID of a customer Char 5 Primary key custFName stores the first name of a customer Varchar2 35 Cannot be null custLName Stores the last name of a customer Varchar2 35 Cannot be null custGender Store the gender of a customer Char 1 It should be ‘M’ or ‘F’ custDOB Stores the date of birth of a customer Date custIncome Store the income of a customer Number 4 Write a SQL query that displays the number of customers who born on the 16th day of a month . Write in SQL a query that displays the ids of the customers who have the highest income . Create a view named ‘customerDetails’ to hold all the details of customers whose first names start with ‘S’ and their incomes are between 500 and 1000 Omani Rials .arrow_forward
- Use the following table to answer the questions below: Table name: Customers Column Name Role Data Type Length Constraint customerID stores the ID of a customer Char 5 Primary key custFName stores the first name of a customer Varchar2 35 Cannot be null custLName Stores the last name of a customer Varchar2 35 Cannot be null custGender Store the gender of a customer Char 1 It should be ‘M’ or ‘F’ custDOB Stores the date of birth of a customer Date custIncome Store the income of a customer Number 4 Write in SQL a command that creates the table Customers according to the above description (2 marks). Write in SQL a statement that adds a new column named accountID of type Char(8). This column should be defined as a foreign key that relates the table Customers to the table Account (1.5 marks). Write in SQL a command that deletes the customers whose date of birth is after 22-Dec-1990 (1.5 Marks).…arrow_forwardBased on the following SQL statement: SELECT acct_id, balance FROM Account WHERE balance < 0 AND acct_type = 'Checking' Which if the following is False? Query is retrieving data from the acct_id and balance columns Query is retrieving data from the Account table Query is retrieving all checking accounts with negative balance Query returns all columns from every row in the Account tablearrow_forwardDesign a query of Stores with the following: Store Name, Store Size, Sum of order amounts, Percent of unpaid order amount, Weighted average volume discount. a. Volume discount: Percent difference between order amount and payment amount Design a query of Stores with the following: Store Name, Sum of all order amounts, Number of all orders, Top customer name, Top customer sum of invoice amounts, Top customer number of invoices, Top customer % of total invoice amount. (4 different tables : Orders table: orderid storeid customerid OrderDate OrderAmount paymentid PreferredOrder orderstatusid Customers table: customerid Name Company Type ContractDate PreferredEnrollmentDate PreferredVoidDate Payments Table: paymentid VolumeDiscount PaymentAmount PaymentDate PaymentMethod Stores Table : storeid Name Store Size Category ContractDate Type Order Status: orderstatusid Namearrow_forward
- Some rows of the STUDENT table are shown below: CODE NAME GPA YEAR 291 ALEX 3.1 2 938 MICHELE 2.3 1 931 JHON 3.3 1 182 JOE 3.4 2 190 REY 2.0 2 330 RON 3.9 3 Which best describes the result of the query below? SELECT YEAR, AVG(GPA) FROM STUDENT WHERE GPA > 2.0 GROUP BY YEAR a. The average maximum GPA of all the students in each year. b. The year of the student with the maximum GPA. c. The average GPA of students with a GPA higher than 2.0 each year. d. The average GPA of the students with a GPA higher than 2.0.arrow_forwardComplete the following join operation to find the set of courses each student has taken. SELECT name, course_id FROM student __________ JOIN takes;arrow_forwardBelow are some rows of the PROVIDERS table for a factory: PCODE 10192 98411 0489035 NAME Hans, Inc. Tools and More Motors Inc. PHONE 231 - 3092 231-1029 993 - 1821 All providers from the factory zone of the city start with 231. You want to get the providers that are in the factory zone of the city. Which of the following is more appropriate? O a. O b. SELECT * FROM PROVIDERS WHERE PHONE LIKE '% 231' O C. O d. SELECT * FROM PROVIDERS WHERE PHONE LIKE $231%' SELECT * FROM PROVIDERS WHERE PHONE LIKE 231 SELECT * FROM PROVIDERS WHERE PHONE LIKE '%231%'arrow_forward
- The team wants to track potential list of users who may have forgotten their items on the cars. Therefore, you need to return USER_FIRST_NAME, USER_LAST_NAME, TRAVEL_START_TIME, TRAVEL_END_TIME information from the USERS and TRAVELS tables connected inside a JOIN statement by the USING function and USER_ID fieldarrow_forwardChange to use the database frozenfood Alter table customerOrder add column total as data type decimal size 7,2, not null, default value of 0.0 Update table customerOrder, set column total equal to column quantity multiplied by subquery a. (select column price from table product where column productId in table customerOrder equals column id in table product) Update table customerOrder, set column orderStatelId equal to subquery a. (select column id from table orderstate where state equals “Payment received") Alter table customerPayment add column paymentDate as data type date, not null, default value of (CURRENT_DATE) (Note: the parenthesis MUST be included) Insert into table customerPayment, columns customerOrderId and total result set returned from query a. Select columns id and total from table customerOrder where column orderStateld is equal to subquery i. (select column id from table orderState where column state is equal to "Payment received") Write Test Case 1 as a SQL join query…arrow_forwardWhich of the following SELECT statements lists only the book with the largest profit? (refer to the tables in the JustLee Books database.)a. SELECT title, MAX(retail-cost)FROM booksGROUP BY title;b. SELECT title, MAX(retail-cost)FROM booksGROUP BY titleHAVING MAX(retail-cost);c. SELECT title, MAX(retail-cost)FROM books;d. none of the abovearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
How to Design DB Tables for any Application? (The Basics); Author: Studytonight;https://www.youtube.com/watch?v=XUdNVaSikqY;License: Standard YouTube License, CC-BY
Create a Table (Introduction to Oracle SQL); Author: Database Star;https://www.youtube.com/watch?v=BiV1IrzB1sY;License: Standard Youtube License