Here’s your MCQs with answers displayed alongside each option for quick reference.
1. What are the different events in Triggers?
a) Drop, Comment, Delete
b) Define, Create, Comment
c) Select, Commit, Define
d) Insert, Update, Delete ✅
2. Which query is used for sorting data that retrieves all the fields from CUSTOMER table and listed them in the ascending order?
a) SELECT * FROM CUSTOMER SORT BY age;
b) SELECT * FROM CUSTOMER ORDER BY COLUMN age;
c) SELECT * FROM CUSTOMER ORDER BY age; ✅
d) SELECT * FROM CUSTOMER ORDER age;
3. Which function can be used to return a specified portion of a character string?
a) STRIP
b) SUBSTR ✅
c) TRIM
d) POS
4. You need to filter return data from your query on the STUDENT table according to the CLASS column. Which clause?
a) WHERE ✅
b) SELECT
c) FROM
d) HAVING
5. Which of the following SQL command can be used to modify existing data in a database table?
a) INSERT
b) MODIFY
c) CHANGE
d) UPDATE ✅
7. Which of the following SQL Statements is right?
a) SELECT FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006'
b) SELECT FROM Sales WHERE Date BETWEEN ('10/12/2005', '01/01/2006')
c) SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006' ✅
d) SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND Date BETWEEN '01/01/2006'
8. What is the difference between the WHERE and HAVING SQL clauses?
a) The having clause is same as the where clause
b) The HAVING SQL clause is applied to all rows in the result. The WHERE clause is used only with SELECT SQL statements and specifies a search condition for an aggregate or a group.
c) The WHERE SQL clause is applied to all rows in the result set. The HAVING clause is used only with SELECT SQL statements and specifies a search condition for an aggregate or a group. ✅
d) None of the above
9. A field whose value uniquely identifies every row in a table?
a) Keys
b) Data type
c) Foreign key
d) Primary key ✅
10. When you COMMIT, is the cursor closed?
a) Yes ✅ (unless declared WITH HOLD)
b) No
11. Which of the following are the five built-in functions provided by SQL?
a) SUM, AVG1, MIN, MAX, NAME
b) COUNT, SUM, AVG, MAX, MIN ✅
c) SUM, AVG, MULT, DIV1, MIN
d) SUM, AVG, MIN, MAX, MULT
12. Is DECLARE CURSOR executable?
a) Yes
b) No ✅
13. How many indexes will be created by the following statement?
Create table TABLE1
( Column1 integer not null primary key,
Column2 integer not null,
Column3 char (20),
Column4 char (10),
Constraint Const_4 unique (Column1,Column2) )
a) 0
b) 3
c) 1
d) 2 ✅
14. Can you have more than one cursor open at any one time in a program?
a) Yes ✅
b) No
15. What does a positive value of SQL code mean?
a) successful execution
b) no rows found
c) warning ✅
d) error
16. What are the aggregate functions supported by DB2?
a) SUM and AVG
b) SUM, MAX, MIN, AVG and COUNT ✅
c) Both of the above
d) None of the above
17. Which of the following DB2 data types cannot be used to create an identity column?
a) NUMERIC
b) SMALLINT
c) DOUBLE ✅
d) INTEGER
✅ Now each MCQ shows the correct answer inline.