Chapter 6 Introduction To SQL
Chapter 6 Introduction To SQL
Chapter 6 Introduction To SQL
The ________ is the structure that contains descriptions of objects such as tables and views
created by users.
A) SQL
B) schema
C) catalog
D) master view
Answer: B
The SQL command ________ defines a logical table from one or more tables or views.
A) create table
B) alter table
C) create view
D) create relationship
Answer: C
The first in a series of steps to follow when creating a table is to:
A) identify columns that must be unique.
B) identify each attribute and its characteristics.
C) create an index.
D) identify columns that must be null.
Answer: B
What does the following SQL statement do?
Alter Table Customer_T
Add (Type Varchar (2));
A) Alters the Customer_T table to accept Type 2 Varchars
B) Alters the Customer_T table to be a Type 2 Varchar
C) Alters the Customer_T table, and adds a field called "Type"
D) Alters the Customer_T table by adding a 2-byte field called "Varchar"
Answer: C
What does the following SQL command do?
insert into Customer_T values (001,'J ohn Smith','231 West St','Boston','MA','02115');
A) Adds a new record to the Customer_T
B) Creates the Customer_T table
C) Deletes the Customer_T table
D) Updates the Customer_T table
Answer: A
Given a table named store with 5 fields: store_id, address, city, state, zipcode, why would the
following insert command not work?
insert into store values ('234 Park Street')
A) It would work just fine.
B) You must specify the fields to insert if you are only inserting some of the fields.
C) There is no table keyword.
D) None of the above.
Answer: B
What does the following SQL statement do?
Delete from Customer_T
where state ='HI';
A) Deletes all records from customer_t where the state is equal to HI
B) Removes the Customer_T table from the database
C) Deletes all records from the Customer_T table
D) None of the above
Answer: A
What does the following SQL statement do?
Update Product_T
Set Unit_Price =775
Where Product_ID =7
A) Changes the price of a unit called Product_T to 7
B) Changes the unit price of Product 7 to 775
C) Changes the length of the Unit_Price field to 775
D) Updates the Product_T table to have a unit price of 775
Answer: B
In an SQL statement, which of the following parts states the conditions for row selection?
A) Select
B) From
C) Where
D) Group By
Answer: C
What does the following SQL statement do?
Select
*
From Customer Where Cust_Type ="Best"
A) Selects all the fields from the Customer table for each row with a customer labeled "Best"
B) Selects the "
*
" field from the Customer table for each row with a customer labeled "Best"
C) Selects fields with a "
*
" in them from the Customer table
D) Selects all the fields from the Customer table for each row with a customer labeled "
*
"
Answer: A
What result will the following SQL statement produce?
Select Avg(standard_price) as average from Product_V;
A) The average of all products in Product_V
B) The average Standard_Price of all products in Product_V
C) The average price of all products
D) None of the above
Answer: B
Which of the following questions is answered by the SQL statement?
Select Count (Product_Description) from Product_T;
A) How many products are in the table Product_T?
B) How many products have product descriptions in the Product Table?
C) How many characters are in the field name "Product_Description"?
D) How many different columns named "Product_Description" are there in table Product_T?
Answer: B
What results will be produced by the following SQL query?
Select sum(standard_price) as Total_Price
from Product_V
where Product_Type ='WOOD';
A) The total price of all products that are of type wood
B) The total price of all products
C) The Standard_Price of the first wood product in the table
D) The Standard_Price of any wood product in the table
Answer: A
Which of the following will produce the minimum of all standard prices?
A) Select standard_price from Product_V where Standard_Price =min;
B) Select min(standard_price) from Product_V;
C) Select Standard_Price from min(Product_V);
D) Select min(Standard_Price) from Product_V where Standard_Price =min(Standard_Price);
Answer: B
What will result from the following SQL Select statement?
Select min(Product_Description)
from Product_V;
A) The minimum value of Product_Description will be displayed.
Denver
D) The Customer_Name of all customers living in Boston, New York or Denver
Answer: B
To get all the customers from Hawaii sorted together, which of the following would be used?
A) ORDER BY
B) GROUP BY
C) HAVING
D) SORT
Answer: A
What will be returned when the following SQL statement is executed?
Select driver_no,count(
*
) as num_deliveries
from deliveries
group by driver_no;
A) A listing of all drivers, sorted by driver number
B) A listing of each driver as well as the number of deliveries that he or she has made
C) A count of all of the deliveries made by all drivers
D) None of the above
Answer: B
What will be returned when the following SQL statement is executed?
Select driver_no, count(
*
) as num_deliveries
from deliveries
where state ='MA'
group by driver_no;
A) A listing of all drivers who made deliveries to state ='MA', sorted by driver number
B) A listing of each driver who made deliveries to state ='MA' as well as the number of
deliveries that each driver has made to that state
C) A count of all of the deliveries made to state ='MA' by all drivers
D) None of the above
Answer: B
What will be returned when the following SQL query is executed?
Select driver_no, count(*) as num_deliveries
from deliveries
group by driver_no
having count(
*
) >2;
A) A listing of all drivers who made more than 2 deliveries as well as a count of the number of
deliveries
B) A listing of all drivers
get back all customers whose total purchases were greater than $100
select customer_id, sum(purchase_price*quantity)
from customer
group by customer_id
having sum(purchase_price*quantity) >100
Diff: 3 Page Ref: 276
Topic: Processing Single Tables
AACSB: Analytic Skills, Reflective Thinking
Subtopic: Qualifying Results by Categories: The HAVING Clause