DB2 - 3 Flashcards
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
Speed up the data access for the queries, and to cluster and partition the data efficiently
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 “
“SELECT COUNT(*) FROM orders “
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
True
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
SELECT COUNT(CustomerID), Country FROM Customers GROUP BY Country
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’)
SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘France’, ‘UK’)
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
Delete the duplicate rows to form the final result set
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
SELECT AVG(Price) AS AveragePrice FROM Products
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’)
INSERT INTO Customers (CustomerName, Address) VALUES (‘Munster’, ‘1313 Mockingbird Lane’)
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
SELECT * FROM Customers ORDER BY Country
UPDATE modifies an existing row.
True or False?
True
False
True