SQL Interview Questions
SQL Interview Questions
PLAY_TABLE
————————————-
“Midsummer Night’s Dream", SHAKESPEARE
“Waiting For Godot", BECKETT
“The Glass Menagerie", WILLIAMS
Parag R. Tokase 1
SQL Interview Questions
1. 60494
2. LOA
3. Terminated
4. ACTIVE
7. SELECT (TO_CHAR(NVL(SQRT(59483), “INVALID")) FROM DUAL is a
valid SQL statement.
1. TRUE
2. FALSE
8. The appropriate table to use when performing arithmetic calculations on
values defined within the SELECT statement (not pulled from a table
column) is
1. EMP
2. The table containing the column values
3. DUAL
4. An Oracle-defined table
9. Which of the following is not a group function?
1. avg( )
2. sqrt( )
3. sum( )
4. max( )
10. Once defined, how long will a variable remain so in SQL*Plus?
1. Until the database is shut down
2. Until the instance is shut down
3. Until the statement completes
4. Until the session completes
11. The default character for specifying runtime variables in SELECT
statements is
1. Ampersand
2. Ellipses
3. Quotation marks
4. Asterisk
12. A user is setting up a join operation between tables EMP and DEPT. There
are some employees in the EMP table that the user wants returned by the
query, but the employees are not assigned to departments yet. Which
SELECT statement is most appropriate for this user?
1. select e.empid, d.head from emp e, dept d;
2. select e.empid, d.head from emp e, dept d where e.dept# = d.dept#;
3. select e.empid, d.head from emp e, dept d where e.dept# = d.dept# (+);
4. select e.empid, d.head from emp e, dept d where e.dept# (+) = d.dept#;
13. Developer ANJU executes the following statement: CREATE TABLE
animals AS SELECT * from MASTER.ANIMALS; What is the effect of this
statement?
1. A table named ANIMALS will be created in the MASTER schema with
the same data as the ANIMALS table owned by ANJU.
2. A table named ANJU will be created in the ANIMALS schema with the
same data as the ANIMALS table owned by MASTER.
Parag R. Tokase 2
SQL Interview Questions
3. A table named ANIMALS will be created in the ANJU schema with the
same data as the ANIMALS table owned by MASTER.
4. A table named MASTER will be created in the ANIMALS schema with
the same data as the ANJU table owned by ANIMALS.
14. User JANKO would like to insert a row into the EMPLOYEE table, which
has three columns: EMPID, LASTNAME, and SALARY. The user would
like to enter data for EMPID 59694, LASTNAME Harris, but no salary.
Which statement would work best?
1. INSERT INTO employee VALUES (59694,’HARRIS’, NULL);
2. INSERT INTO employee VALUES (59694,’HARRIS’);
3. INSERT INTO employee (EMPID, LASTNAME, SALARY) VALUES
(59694,’HARRIS’);
4. INSERT INTO employee (SELECT 59694 FROM ‘HARRIS’);
15. Which three of the following are valid database datatypes in Oracle? (Choose
three.)
1. CHAR
2. VARCHAR2
3. BOOLEAN
4. NUMBER
16. Omitting the WHERE clause from a DELETE statement has which of the
following effects?
1. The delete statement will fail because there are no records to delete.
2. The delete statement will prompt the user to enter criteria for the deletion
3. The delete statement will fail because of syntax error.
4. The delete statement will remove all records from the table.
17. Creating a foreign-key constraint between columns of two tables defined with
two different datatypes will produce an error.
1. TRUE
2. FALSE
18. Dropping a table has which of the following effects on a nonunique index
created for the table?
1. No effect.
2. The index will be dropped.
3. The index will be rendered invalid.
4. The index will contain NULL values.
19. To increase the number of nullable columns for a table,
1. Use the alter table statement.
2. Ensure that all column values are NULL for all rows.
3. First increase the size of adjacent column datatypes, then add the column.
4. Add the column, populate the column, then add the NOT NULL
constraint.
20. Which line of the following statement will produce an error?
1. CREATE TABLE goods
2. (good_no NUMBER,
3. good_name VARCHAR2 check(good_name in (SELECT name FROM
avail_goods)),
Parag R. Tokase 3
SQL Interview Questions
4. CONSTRAINT pk_goods_01
5. PRIMARY KEY (goodno));
6. There are no errors in this statement.
21. MAXVALUE is a valid parameter for sequence creation.
1. TRUE
2. FALSE
22. Which of the following lines in the SELECT statement below contain an
error?
1. SELECT DECODE(empid, 58385, “INACTIVE", “ACTIVE") empid
2. FROM emp
3. WHERE SUBSTR(lastname,1,1) > TO_NUMBER(’S')
4. AND empid > 02000
5. ORDER BY empid DESC, lastname ASC;
6. There are no errors in this statement.
23. Which function below can best be categorized as similar in function to an IF-
THEN-ELSE statement?
1. SQRT
2. DECODE
3. NEW_TIME
4. ROWIDTOCHAR
24. Which two of the following orders are used in ORDER BY clauses? (choose
two)
1. ABS
2. ASC
3. DESC
4. DISC
25. You query the database with this command
SELECT name
FROM employee
WHERE name LIKE ‘_a%’;
Parag R. Tokase 4