SQL Interview Questions and Answers for IBM i developer

This blog contains SQL Interview questions for IBM i developers.
SQL Interview Questions and Answers for IBM i developer, interview questions, SQL interview questions, SQL quiz, SQL db2 interview questions for ibm i,as400, as400andsqltricks,triggers in SQL db2, trigger events, ORDER BY clause in SQL DB2, WHERE clause in SQL DB2, SUBSTR in SQL DB2, SUBSTR, ORDER BY, SQL UPDATE, BETWEEN clause in SQL DB2, HAVING clause in SQL DB2, Difference between WHERE and HAVING clause in SQL, COMMIT in SQL, Primary Key in SQL DB2, Primary key, PK value,COUNT, SUM, AVG, MIN, MAX,SQL Aggregate function, Cursor in SQL db2, Positive SQL code, DECLARE cursor statement in SQL DB2,DB2 Data types, identity column,comparison operator in SQL DB2
SQL Interview Questions and Answers for IBM i developer

Q1: What are the different events in Triggers?

  1. Drop, Comment, Delete
  2. Define, Create, Comment
  3. Select, Commit, Define
  4. Insert, Update, Delete

Answer 1:

4. Insert, Update, Delete

Q2: Which query is used for sorting data that retrieves all the fields from the CUSTOMER table and listed them in ascending order?

  1. SELECT * FROM CUSTOMER SORT BY age
  2. SELECT * FROM CUSTOMER ORDER BY COLUMN age
  3. SELECT * FROM CUSTOMER ORDER BY age
  4. SELECT * FROM CUSTOMER ORDER age

Answer 2:

3. FROM CUSTOMER ORDER BY age

Q3:Which function can be used to return a specified portion of a character string?

  1. STRIP
  2. SUBSTR
  3. TRIM
  4. POS

Answer 3:

2. SUBSTR

Q4:You need to filter return data from your query on the STUDENT table according to the CLASS column. Which of the following clauses in your SQL query will contain a reference to the appropriate filter criteria?

  1. WHERE
  2. SELECT
  3. FROM
  4. HAVING

Answer 4:

1. WHERE

Q5:Which of the following SQL command can be used to modify existing data in a database table?

  1. INSERT
  2. MODIFY
  3. CHANGE
  4. UPDATE

Answer 5:

4. UPDATE

Q6:which of the following SQL Statements is right?

  1. SELECT FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006'
  2. SELECT FROM Sales WHERE Date BETWEEN ('10/12/2005', '01/01/2006')
  3. SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006'
  4. SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND Date BETWEEN '01/01/2006'

Answer 6:

3. SELECT * FROM Sales WHERE Date BETWEEN '10/12/2005' AND '01/01/2006'

Q7:What is the difference between the WHERE and HAVING SQL clauses?

  1. The having clause is the same as the where clause
  2. 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
  3. 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.
  4. None of the above

Answer 7:

3. 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.

Q8:A field whose value uniquely identifies every row in a table?

  1. keys
  2. data type
  3. foreign key
  4. primary key

Answer 8:

4. primary key

Q9:When you COMMIT, is the cursor closed?

  1. yes
  2. no

Answer 9:

1. yes

Q10:Which of the following are the five built-in functions provided by SQL?

  1. SUM, AVG1, MIN, MAX, NAME
  2. COUNT, SUM, AVG, MIN, MAX
  3. SUM, AVG, MULT, DIV1, MIN
  4. SUM, AVG, MIN, MAX, MULT

Answer 10:

2. COUNT, SUM, AVG, MIN, MAX

Q11:Is DECLARE CURSOR executable?

  1. yes
  2. no

Answer 11:

2.no

Q12: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)
 }
  1. 0
  2. 3
  3. 1
  4. 2

Answer 12:

4.2

Q13:.Can you have more than one cursor open at any one time in a program?

  1. yes
  2. no

Answer 13:

1. yes

Q14:What does a positive value of SQL code mean?

  1. successful execution
  2. no rows found
  3. warning
  4. error

Answer 14:

3. warning

Q15:What are the aggregate functions supported by DB2?

  1. SUM and AVG
  2. SUM, MAX, MIN, AVG, and COUNT
  3. Both of the above
  4. none of the above

Answer 15:

2. SUM, MAX, MIN, AVG, and COUNT

Q16:Which of the following DB2 data types cannot be used to create an identity column?

  1. NUMERIC
  2. SMALLINT
  3. DOUBLE
  4. INTEGER

Answer 16:

3. double

Q17:which of the following query is correct for using the comparison operator in SQL

  1. SELECT CUTSNAME FROM CUSTOMER where age >50 and where age <80
  2. SELECT CUTSNAME FROM CUSTOMER where age >50 and <80
  3. SELECT CUTSNAME FROM CUSTOMER where age >50 and age <80
  4. none of the above

Answer 17:

3. SELECT CUTSNAME FROM CUSTOMER where age >50 and age <80

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain