0% found this document useful (0 votes)
41 views33 pages

Final Exam: - Bring Your Own Scantron Sheet, Pencil, Eraser

The document provides information about an upcoming final exam, including: - The exam will take place on May 14th at 6 PM in class. It will cover chapters 5 to 7 and slides 22 to 38 from Chapter 1. - The exam will be objective type with 15 true/false questions and 35 multiple choice questions for a total of 25 points. It will be closed book, notes, and laptops and last 2 hours. - Students should bring their own scantron sheet, pencil, and eraser. The document wishes students best of luck on the exam.

Uploaded by

Voteme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views33 pages

Final Exam: - Bring Your Own Scantron Sheet, Pencil, Eraser

The document provides information about an upcoming final exam, including: - The exam will take place on May 14th at 6 PM in class. It will cover chapters 5 to 7 and slides 22 to 38 from Chapter 1. - The exam will be objective type with 15 true/false questions and 35 multiple choice questions for a total of 25 points. It will be closed book, notes, and laptops and last 2 hours. - Students should bring their own scantron sheet, pencil, and eraser. The document wishes students best of luck on the exam.

Uploaded by

Voteme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Final Exam

• When: May 14, 6 PM


• Where: in class
• What to read: chapters 5 to 7 and Dimensional Modeling (slides 22 to 38 from Chapter
1 ppt)

• All objective type questions


• 15 True or False
• 35 Multiple choice
• Total points: 25
• Closed book, notes, laptops.
• Duration: 2 hours

• Bring your own scantron sheet, pencil, eraser.

BEST OF LUCK!

11/19/21 08:10 PM 1
SAMPLE FINAL QUESTIONS

11/19/21 08:10 PM 2
True or False
• Applications can be moved from one machine to another when each
machine uses SQL. T

• A database is maintained and queried using the Data Manipulation


Language (DML). T

• When creating a table, it is not important to consider foreign key - primary


key mates. F

• The DROP command deletes rows from a table individually or in groups


while keeping the table schema intact. F

• The asterisk (*) wildcard designator can be used to select all fields from a
table. T
11/19/21 08:10 PM 3
True or False

• WHERE clause is a required statement. F

• DELETE statement is used to remove a table. F

• ALTER TABLE command is used to add or delete columns. T

• DELETE FROM CUSTOMER_T deletes all rows from CUSTOMER_T. T

• Use IN when the subquery returns a list of values. T

11/19/21 08:10 PM 4
True or False

• If multiple Boolean operators are used in an SQL statement, NOT is


evaluated first, then OR, then AND. F

• The following two SQL statements will produce different results. F


 
Select last_name, first_name
from customer
where state = 'MA' or state = 'NY' or state = 'NJ' or state = 'NH' or state = 'CT';
 
Select last_name, first_name
from customer
where state in ('MA','NY','NJ','NH','CT');

11/19/21 08:10 PM 5
True or False

• The following query totals sales in state = 'MA' for each salesperson.

Select salesperson_id, sum(sales) F


from salesperson (Because state is not contained
group by salesperson_id in either an aggregate function
having state = 'MA'; or in Group By clause)
• Using aggregate functions will give a one-row answer. T

• The OR Boolean operator joins two or more conditions and returns results only when all
conditions are true. F

• The joining condition of an Inner Join is based upon an equality.


T

11/19/21 08:10 PM 6
True or False

• In the following relational schema the STORAGE table is created before


creating ITEM and LOCATION tables.
F

• DELETE statement is used to remove a table.


F

• Following query will show an error message.


SELECT Product_Description, Standard_Price T
FROM PRODUCT_t (Use LIKE instead of =)
WHERE Product_Description = ‘%Desk’;

11/19/21 08:10 PM 7
True or False

• GROUP BY statement is used to sort the field values. F

• The keyword DECS is used after the field name to display the field in
descending order. T

• Following query will give an error message.


SELECT CUSTOMER_STATE, COUNT(CUSTOMER_STATE)
FROM CUSTOMER_T
HAVING COUNT(CUSTOMER_STATE) > 1
GROUP BY CUSTOMER_STATE;

T (Group By should come before Having clause)


11/19/21 08:10 PM 8
True or False

• HAVING test a criterion for an aggregate function while WHERE test a


criterion for a row. T

• ORDER BY is always the last clause if used T

• Following query will give an error message.


SELECT COUNT(Hours_Worked)
FROM Employee
WHERE COUNT(Hours_Worked) > 3 ;

T (WHERE test a criterion for a row not for an aggregate


function)
11/19/21 08:10 PM 9
True or False
• A subquery is an inner query (SELECT…FROM…WHERE) within a WHERE or HAVING
clause of another (outer) query. T

• In the following query, first the CustomerName is selected from Customer_T and
then the corresponding CustomerID is matched with the CustomerID in the
Order_T F
SELECT CustomerName FROM Customer_T

WHERE CustomerID IN

(SELECT CustomerID FROM Order_T);

11/19/21 08:10 PM 10
True or False
• Using an outer join produces this information: rows that do not have matching
values in common columns are also included in the result table. T

• If the subquery returns multiple CustomerIDs then we have to use = instead of IN


operator F

SELECT CustomerName FROM Customer_T

WHERE CustomerID IN

(SELECT CustomerID FROM Order_T);

11/19/21 08:10 PM 11
True or False

• The subquery is placed in the FROM clause when the result of the
subquery is required to be displayed. T

• Cube slicing is an OLAP operation. T

• Following query will give an error message.


SELECT ProductFinish, AVG(ProductStandardPrice) AS AVERAGE
FROM PRODUCT_t T
GROUP BY ProductFinish (Cannot use alias given to an
HAVING AVERAGE < 400; aggregate function in the
HAVING clause)
11/19/21 08:10 PM 12
True or False

• An OLAP cube is created by converting the dimensional format into a


relational format. F

• OLAP cubes deliver superior query performance because of T


pre-calculations, indexing strategies, and other optimizations.

• Following query will give an error message.


SELECT OrderID, SUM(OrderedQuantity) AS TotalQty
FROM OrderLine_T T (Because
OrderID is not
GROUP BY OrderedQuantity contained in either an
HAVING SUM(OrderedQuantity) > 10; aggregate function or in
Group By clause)
11/19/21 08:10 PM 13
True or False

• Slicing in OLAP is like a ‘WHERE’ clause in SQL. T

• The table that provides the data for the elements of the Cube
in OLAP is called a Fact Table. T

• A 3-dimensional Cube can be ‘sliced’ to obtain a 2-dimensional table. T

11/19/21 08:10 PM 14
True or False
The following queries produce the same results. T
 
SELECT CustomerName FROM Customer_T, Order_T
 
WHERE Customer_T.CustomerID = Order_T.CustomerID;

SELECT CustomerName FROM Customer_T

WHERE CustomerID IN

(SELECT CustomerID FROM Order_T);

The following query will execute without errors: F


 
SELECT Order_T.CustomerID, CustomerName FROM Customer_T
WHERE CustomerID IN
(SELECT CustomerID FROM Order_T WHERE OrderID = 1008);
11/19/21 08:10 PM 15
Multiple Choice
Data Definition Language is used at the _______________ step of the database life cycle.
A) Physical design C) Maintenance
B) Logical design D) Implementation
Answer: A
 
________ is a set of commands used to update and query a database.
A) DDL C) DCL
B) DML D) DPL
Answer: B

A join in which the joining condition is based on equality between values in the common columns
is called a(n):
A) Inner join. C) Left Outer join.
B) Right Outer join. D) Full join.
Answer: A

11/19/21 08:10 PM 16
Multiple Choice
Any create command may be reversed by using a ________ command.
A) remove C) delete
B) drop D) unpack
Answer: B

In creating a query, which keyword eliminates duplicate rows of output?


A) DISTINCT C) ORDER BY
B) DESC D) WHERE
Answer: A

A join operation:
A) brings together data from two different fields.
B) causes two tables with a common domain to be combined into a single table or view.
C) causes two disparate tables to be combined into a single table or view.
D) is used to combine indexing operations.
Answer: B
11/19/21 08:10 PM 17
Multiple Choice
What does the following SQL statement do?
A) Alters the Customer_T table to accept Type 2 Varchars Alter Table Customer_T
B) Alters the Customer_T table to be a Type 2 Varchar Add (Type varchar (2));
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 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

11/19/21 08:10 PM 18
Multiple Choice
What does the following SQL statement do?

A) Changes the price of a unit called Product_T to 7 Update Product_T


B) Changes the unit price of ProductID 7 to 775 Set UnitPrice = 775
C) Changes the length of the UnitPrice field to 775 Where ProductID = 7;
D) Updates the Product_T table to have a unit price of 775
Answer: B
 
What does the following SQL statement do?
  Select * From Customer_T 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

11/19/21 08:10 PM 19
Multiple Choice
What result will the following SQL statement produce?
 
Select Avg(ProductStandardPrice) as Average from Product_T;
 
A) Displays the average number of all products in Product_T
B) Displays the average of product standard price of all products in Product_T
C) Displays the average price of each product
D) None of the above
Answer: B

 What results will be produced by the following SQL query?


A) The total standard price of all products that are of type wood
B) The total standard price of all products Select
sum(ProductStandardPrice) as
C) The standard price of the first wood product in the table
total_price from Product_T
D) The standard price of any wood product in the table where ProductType = 'WOOD';
Answer: A

11/19/21 08:10 PM 20
Multiple Choice

Shipment_T The database contains two tables: Shipment and Parts


SNUM PNUM
(PK,FK) (PK,FK) QTY
S1 P1 300
S1 P2 200
How many records would the following SQL query
S1 P6 100 return?
S2 P1 300
S2 P2 400
 
S3 P2 200 SELECT Distinct Shipment_T.SNUM
S4 P2 200   FROM Shipment_T, Parts_T
S4 P4 300
  Parts_T  
Where Parts_T.PNUM = Shipment_T.PNUM and
PNUM (Parts_T.COLOR=‘Red’);
(PK) PNAME COLOR WEIGHT
P1 Nut Red 12
P2 Bolt Green 17 A) 0 C) 3
P3 Screw Red 17
P4 Screw Red 14 B) 2 D) 4
P5 Cam Blue 12
P6 Cog Red 19

Result: S1, S2 and S4

11/19/21 08:10 PM 21
Multiple Choice

  Suppliers_T  
What should be the result of the following query?
SNUM
(PK) SNAME STATUS CITY  
S1 Smith 20 London SELECT DISTINCT CITY
S2 Jones 10 Paris FROM Suppliers_T GROUP BY CITY
S3 Blake 30 Paris
HAVING SUM(STATUS) > 35;
S4 Clark 20 London
S5 Adams 30 Athens
A) London C) Paris
B) London and Paris D) Athens

Answer: B
11/19/21 08:10 PM 22
Multiple Choice

The database contains three tables: Suppliers, Parts and Shipment


  What should be the result of the
  Suppliers_T    
Shipment_T
SNUM SNUM PNUM following query?
(PK) SNAME STATUS CITY   (PK,FK) (PK,FK) QTY
S1 Smith 20 London   S1 P1 300  
S2 Jones 10 Paris   S1 P2 200 SELECT SNAME
S3 Blake 30 Paris   S1 P6 100
S4 Clark 20 London   S2 P1 300 FROM Suppliers_T, Shipment_T,
S5 Adams 30 Athens   S2 P2 400 Parts_T
          S3 P2 200
S4 P2 200 WHERE Suppliers_T.SNUM =
  Parts_T     S4 P4 300 Shipment_T.SNUM
PNUM
(PK) PNAME COLOR WEIGHT   AND Shipment_T.PNUM =
P1 Nut Red 12        
P2 Bolt Green 17        
Parts_T.PNUM
P3 Screw Blue 17         AND PNAME = ‘Screw’;
P4 Screw Red 14        
P5 Cam Blue 12        
P6 Cog Red 19         A) Blake C) Blake and Clark
B) Smith D) Clark
Answer: D
11/19/21 08:10 PM 23
Multiple Choice
Consider the following SQL
  Parts_T  

SELECT PNAME
PNUM (PK) PNAME COLOR WEIGHT
FROM Parts_T
P1 Nut Red 12
WHERE PNUM IN P2 Bolt Green 17
(SELECT PNUM FROM Parts_T P3 Screw Blue 17
WHERE WEIGHT>15 P4 Screw Red 14
AND COLOR=‘Red’); P5 Cam Blue 12
  P6 Cog Red 19
Which PNAME(s) will appear in the result?
A. Only “Cog” will appear
B. Only “Bolt” will appear
C. Only “Nut” will appear
D. Both “Cog” and “Screw” will appear
E. Both “Cog” and “Bolt” will appear
Answer: A

11/19/21 08:10 PM 24
Multiple Choice
What will result from the following SQL Select statement?
  Select min(ProductDescription) from Product_T;
A) The minimum value of ProductDescription will be displayed.
B) An error message will be generated.
C) The first product description alphabetically in Product_T will be shown.
D) None of the above.
Answer: C

Which of the following is not an operation/feature in OLAP.


A) Slicing
B) Rotating (Pivoting)
C) Drill down
D) Leveling
Answer: D

11/19/21 08:10 PM 25
Multiple Choice
Which of the following statement is used to rename a column?
A) LIKE C) =
B) AS D) Both options A) and B)
Answer: B

A type of join where a table is joined to itself is called a(n) ________.


A) unary join C) unnatural join
B) self join D) pinned join
Answer: B

________ takes a value of true if a subquery returns an intermediate results table which contains
one or more rows.
A) IN C) EXISTS
B) HAVING D) NOT EXISTS
Answer: C

11/19/21 08:10 PM 26
Multiple Choice

What will be returned when the following SQL statement is executed?


  Select driver_no, count(*) as num_deliveries
  from deliveries_t 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

A join in which rows that do not have matching values in common columns are still included in
the result table is called a(n):
A) Inner join. C) outer join
B) equi-join. D) union join.
Answer: C
11/19/21 08:10 PM 27
Multiple Choice
• Which of the following WHERE clause is used to join the three tables?
TABLE3(PK3, other attributes, FK3) TABLE2(PK2, other attributes, FK2) TABLE1(PK1, other attributes)

A) WHERE TABLE1.PK1 = TABLE2. PK2 AND TABLE2.PK2=TABLE3.PK3


B) WHERE TABLE1.PK1 = TABLE2. FK2 AND TABLE2.PK2=TABLE3.PK3
C) WHERE TABLE1.PK1 = TABLE3. FK3
D) WHERE TABLE1.PK1 = TABLE2. FK2 AND TABLE2.PK2=TABLE3.FK3
Answer: D
The SQL command ________ adds one or more new columns to a table.
A) create table
B) alter table
C) create view
D) create relationship
Answer: B

11/19/21 08:10 PM 28
Multiple Choice
What will result from the following SQL statement?

SELECT CustomerName
FROM CUSTOMER_T
  WHERE CustomerState = (‘FL’, ‘TX’, ‘CA’);
A) Name of customers from states FL or TX or CA are displayed.
B) Name of customers from states FL and TX and CA are displayed.
C) Name of customers not belonging to states FL or TX or CA are displayed.
D) An error message will be generated.
Answer: D

Which of the following is true about a derived table in SQL?


A) It is a temporary table used in the same query
B) It can be selected to display in the query
C) It is created in the FROM clause
D) All of the above
Answer: D
11/19/21 08:10 PM 29
Multiple Choice
 What result set will the following query return?

Select item_no, description


from item where weight >= 100 and weight <= 200;
A) The item_no and description for all items weighing either <= 200 or >= 100
B) The item_no and description for all items weighing at most 200
C) The item_no and description for all items weighing between 100 and 200 including 100 and
200
D) The item_no and description for all items weighing at least 100
Answer: C

11/19/21 08:10 PM 30
Multiple Choice
 What is true about the following Order By clause?

SELECT CustomerName, CustomerState FROM CUSTOMER_T


WHERE CustomerState IN (‘FL’, ‘TX’, ‘CA’)
ORDER BY CustomerState, CustomerName;
A) Customers are sorted alphabetically by state and then by customer name within each state
B) Customers are sorted alphabetically by name and then by customer state within each name
C) Shows an error message
D) Customers are sorted in ascending order by state and then in descending order by customer
name within each state
Answer: A

11/19/21 08:10 PM 31
Multiple Choice
 What is true about the following Order By clause?

SELECT CustomerName, CustomerState FROM CUSTOMER_T


WHERE CustomerState IN (‘FL’, ‘TX’, ‘CA’)
ORDER BY DESC CustomerState, CustomerName;
A) Customers are sorted in ascending order by state and then in descending order by customer
name within each state
B) Customers are sorted in descending order by state and then in ascending order by customer
name within each state
C) Shows an error message
D) Customers are sorted in descending order by state and then in descending order by customer
name within each state
Answer: C

11/19/21 08:10 PM 32
Multiple Choice
 A ________ is a temporary table used in the FROM clause of an SQL query.
A) correlated subquery C) view table
B) derived table D) none of the above
Answer: B

Which of the following is an disadvantage of VIEWS


A) Simplify query commands. C) Use little storage space
B) Use processing time each time view is referenced D) Provide customized view
Answer: B

Going from a summary view to progressively lower levels of detail is called data:
A) cubing. C) dicing
B) drill-down. D) pivoting
Answer: B

11/19/21 08:10 PM 33

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy