DB2 - 3 Flashcards

1
Q

An Index is created on the DB2 table column to:

Alternate a key for a VSAM file
Speed up the data access for the queries, and to cluster and partition the data efficiently
Provide a method to interface a sam file

A

Speed up the data access for the queries, and to cluster and partition the data efficiently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What would be the SQL statement to get the number of rows in the orders table?

“SELECT COUNT() FROM Product “
“SELECT * FROM orders “
“SELECT COUNT(
) FROM orders “
“SELECT lastName FROM orders “

A

“SELECT COUNT(*) FROM orders “

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DB2 UNION operator allows you to combine the result sets of two or more subselects into a single result set.

True or False?

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What would be the SQL to get the count of customersID in each country from the Customers table?

  SELECT COUNT(CustomerID), Country FROM Customers GROUP BY Country 
  SELECT AVG(CustomerID), Country FROM Customers GROUP BY Country 
  SELECT CustomerID FROM Customers 
  SELECT CustomerID, Country FROM Product
A

SELECT COUNT(CustomerID), Country FROM Customers GROUP BY Country

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which is correct SQL to get all columns from the Customers table where the country is Germany, France, and the UK?

SELECT * FROM Customers WHERE Country IN (‘UK’)
SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘UK’)
SELECT * FROM Customers WHERE Country IN (‘Germany’)
SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘France’, ‘UK’)

A

SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘France’, ‘UK’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which statement is true when the UNION operator is used on 2 tables?

Delete the duplicate rows to form the final result set
A VSAM file will be created
A flat file will be read
A new data set will be created by ZOS

A

Delete the duplicate rows to form the final result set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What would be the SQL statement to get the average Price from the Products table?

  SELECT AVG(Price) AS AveragePrice FROM Products 
  SELECT AVG(Price) AS AveragePrice FROM ProductDetail 
  SELECT Price(AVG) FROM ProductDetail 
  SELECT Price FROM Product
A

SELECT AVG(Price) AS AveragePrice FROM Products

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which is the correct SQL to insert CustomerName and Address into Customers Table?

INSERT INTO Cust77(CustomerName, Address) VALUES (‘Munster’, ‘1313 Mockingbird Lane’)
INSERT INTO Products(CustomerName, Address) VALUES (‘Munster’, ‘1313 Mockingbird Lane’)
INSERT INTO Customers (CustomerName, Address) VALUES (‘Munster’, ‘1313 Mockingbird Lane’)
ADD INTO Customers (CustomerName, Address) VALUES (‘Munster’, ‘1313 Mockingbird Lane’)

A

INSERT INTO Customers (CustomerName, Address) VALUES (‘Munster’, ‘1313 Mockingbird Lane’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following is the correct SQL to: select all the columns in the Customers table and sort by Country?

SELECT * FROM Customers
SELECT * FROM Customers ORDER BY Product
SELECT * FROM Customers ORDER BY Country
SELECT * FROM Countries ORDER BY Country

A

SELECT * FROM Customers ORDER BY Country

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

UPDATE modifies an existing row.

True or False?

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly