1.
Given the following query:
SELECT quantity,
CASE WHEN itemcode = '099' THEN 'SILVER'
WHEN itemcode = '788' THEN 'GOLD'
WHEN itemcode = '899' THEN 'PLATINUM'
ELSE 'ERROR'
END
FROM supplier
What will be the result of the query if the following data is evaluated by the CASE expression?
SUPPLIER
------------------------------------------
QUANTITY ITEMCODE
3 099
4 099
1 788
1 899
5 009
3 788
1 899
2.
Given the following expression:
SELECT QUANTITY,
CASE WHEN ITEMCODE = '099' THEN "SILVER"
WHEN ITEMCODE = '788' THEN "GOLD"
WHEN ITEMCODE = '899' THEN "PLATINUM"
ELSE ERROR
END
FROM SUPPLIER
What will be the result of the query if the following data is evaluated by the CASE expression?
QUANTITY ITEMCODE
3 099
4 099
1 788
1 899
5 009
3 788
1 899
3.
Which of the following queries will correctly return the manager information sorted by the manager's last name, department and project name?
4.
Assuming table TAB1 contains 100 rows, which of the following queries will return only half of the rows available?
5.
Given the following two tables:
NAMES
NAME NUMBER
---------- -------
Wayne Gretzky 99
Jaromir Jagr 68
Bobby Orr 4
Bobby Hull 23
Brett Hull 16
Mario Lemieux 66
Mark Messier 11
POINTS
NAME POINTS
---------- ------
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Brett Hull 121
Mario Lemieux 189
Joe Sakic 94
Which of the following statements will display the player name, number, and points for all players that have scored points?
6.
Which of the following is a valid wildcard character in a LIKE clause of a SELECT statement?
7.
Given the following tables:
YEAR_2006
EMPID NAME
----- ---------------
1 Jagger, Mick
2 Richards, Keith
3 Wood, Ronnie
4 Watts, Charlie
5 Jones, Darryl
6 Leavell, Chuck
YEAR_1962
EMPID NAME
----- ---------------
1 Jagger, Mick
2 Richards, Keith
3 Jones, Brian
4 Wyman, Bill
5 Watts, Charlie
6 Stewart, Ian
If the following SQL statement is executed, how many rows will be returned?
SELECT name FROM year_2007
UNION ALL
SELECT name FROM year_1962
8.
Given the following table definition:
SALES
--------------------------------------
INVOICE_NO CHAR(20) NOT NULL
SALES_DATE DATE
SALES_PERSON VARCHAR(25)
REGION CHAR(20)
SALES_AMT DECIMAL(9,2)
Which of the following queries will return SALES information, sorted by SALES_PERSON, from A to Z, and SALES_DATE, from most recent to earliest?
9.
Given the following statement:
SELECT hyear, AVG(salary)
FROM (SELECT YEAR(hiredate) AS hyear, salary
FROM employee WHERE salary > 30000)
GROUP BY hyear
Which of the following describes the result if this statement is executed?
10.
Which two of the following statements are true about the HAVING clause?