Top 5 SQL Tricky Questions to Ask

Interviews questions sometimes tricky. Here is a list of five SQL queries.

SQL Tricky Questions

Q.1)If the following command is executed: CREATE DATABASE test What is the page size (in
kilobytes) of the database?

A. 4
B. 8
C. 16
D. 32
Answer: A

Q.2)Given the following DDL statement: CREATE TABLE sales (item CHAR(20)); If a DBA
wishes to increase the size of the ITEM column, which SQL statement needs to be used?

A. ALTER TABLE sales ADD COLUMN item CHAR(40);
B. ALTER TABLE sales ALTER COLUMN item CHAR(40);
C. ALTER TABLE sales MODIFY COLUMN item CHAR(40);
D. ALTER TABLE sales ALTER COLUMN item SET DATA TYPE CHAR(40);
Answer: D

Q.3)Which DB2 object can be used to improve the execution performance of qualified SELECT statements?

A. Trigger
B. SQL Procedure
C. Sequence Object
D. Materialized Query Table
Answer: D

Q.4)When is it appropriate to use a sequence?

A. When you want to control the order in which triggers are fired.
B. When you want to control the order in which stored procedures can be invoked.
C. When you want to automatically generate a numeric value that is not tied to any specific
column or table.
D. When you want to automatically generate a numeric value for each row that is added to
a specific table.
Answer: C

Q.5)Which clause should be included in a ALTER TABLE statement to update a table definition with a new column?

A. ADD COLUMN
B. ALTER COLUMN
C. APPEND COLUMN
D. RENAME COLUMN
Answer: A

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.

2 thoughts

  1. Hi Srinimf –
    I have a IBM Mainframe Cobol program with sequence numbers in 1 to 6 columns How to remove them from the program? Can you let me know the commands?
    Thanks. Suresh

    Like

Comments are closed.