|
Placement
Papers
>>
General >>
SQL Interview
Questions
-
Which of the following statements contains an error?
-
SELECT * FROM emp WHERE empid = 493945;
-
SELECT empid FROM emp WHERE empid= 493945;
-
SELECT empid FROM emp;
-
SELECT empid WHERE empid = 56949 AND lastname =
‘SMITH’;
-
Which of the following correctly describes how to
specify a column alias?
- Place
the alias at the beginning of the statement to
describe the table.
- Place
the alias after each column, separated by white
space, to describe the column.
- Place
the alias after each column, separated by a comma, to
describe the column.
- Place
the alias at the end of the statement to describe the
table.
- The
NVL function
-
Assists in the distribution of output across multiple
columns.
-
Allows the user to specify alternate output for
non-null column values.
-
Allows the user to specify alternate output for null
column values.
-
Nullifies the value of the column output.
-
Output from a table called PLAYS with two columns,
PLAY_NAME and AUTHOR, is shown below. Which of the
following SQL statements produced it?
PLAY_TABLE
————————————-
“Midsummer Night’s Dream”, SHAKESPEARE
“Waiting For Godot”, BECKETT
“The Glass Menagerie”, WILLIAMS
-
SELECT play_name || author FROM plays;
-
SELECT play_name, author FROM plays;
-
SELECT play_name||’, ‘ || author FROM plays;
-
SELECT play_name||’, ‘ || author PLAY_TABLE FROM
plays;
-
Issuing the DEFINE_EDITOR=”emacs” will produce which
outcome?
- The
emacs editor will become the SQL*Plus default text
editor.
- The
emacs editor will start running immediately.
- The
emacs editor will no longer be used by SQL*Plus as
the default text editor.
- The
emacs editor will be deleted from the system.
- The
user issues the following statement. What will be
displayed if the EMPID selected is 60494?
SELECT
DECODE(empid,38475, “Terminated”,60494, “LOA”,
“ACTIVE”)
FROM emp;
- 60494
- LOA
-
Terminated
-
ACTIVE
-
SELECT (TO_CHAR(NVL(SQRT(59483), “INVALID”)) FROM DUAL
is a valid SQL statement.
- TRUE
- FALSE
- The
appropriate table to use when performing arithmetic
calculations on values defined within the SELECT
statement (not pulled from a table column) is
- EMP
- The
table containing the column values
- DUAL
- An
Oracle-defined table
-
Which of the following is not a group function?
- avg(
)
- sqrt(
)
- sum(
)
- max(
)
- Once
defined, how long will a variable remain so in
SQL*Plus?
- Until
the database is shut down
- Until
the instance is shut down
- Until
the statement completes
- Until
the session completes
- The
default character for specifying runtime variables in
SELECT statements is
-
Ampersand
-
Ellipses
-
Quotation marks
-
Asterisk
- 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?
-
select e.empid, d.head from emp e, dept d;
-
select e.empid, d.head from emp e, dept d where
e.dept# = d.dept#;
-
select e.empid, d.head from emp e, dept d where
e.dept# = d.dept# (+);
-
select e.empid, d.head from emp e, dept d where
e.dept# (+) = d.dept#;
-
Developer ANJU executes the following statement: CREATE
TABLE animals AS SELECT * from MASTER.ANIMALS; What is
the effect of this statement?
- A
table named ANIMALS will be created in the MASTER
schema with the same data as the ANIMALS table owned
by ANJU.
- A
table named ANJU will be created in the ANIMALS
schema with the same data as the ANIMALS table owned
by MASTER.
- A
table named ANIMALS will be created in the ANJU
schema with the same data as the ANIMALS table owned
by MASTER.
- A
table named MASTER will be created in the ANIMALS
schema with the same data as the ANJU table owned by
ANIMALS.
- 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?
-
INSERT INTO employee VALUES (59694,’HARRIS’, NULL);
-
INSERT INTO employee VALUES (59694,’HARRIS’);
-
INSERT INTO employee (EMPID, LASTNAME, SALARY) VALUES
(59694,’HARRIS’);
-
INSERT INTO employee (SELECT 59694 FROM ‘HARRIS’);
-
Which three of the following are valid database
datatypes in Oracle? (Choose three.)
- CHAR
-
VARCHAR2
-
BOOLEAN
-
NUMBER
-
Omitting the WHERE clause from a DELETE statement has
which of the following effects?
- The
delete statement will fail because there are no
records to delete.
- The
delete statement will prompt the user to enter
criteria for the deletion
- The
delete statement will fail because of syntax error.
- The
delete statement will remove all records from the
table.
-
Creating a foreign-key constraint between columns of
two tables defined with two different datatypes will
produce an error.
- TRUE
- FALSE
-
Dropping a table has which of the following effects on
a nonunique index created for the table?
- No
effect.
- The
index will be dropped.
- The
index will be rendered invalid.
- The
index will contain NULL values.
- To
increase the number of nullable columns for a table,
- Use
the alter table statement.
-
Ensure that all column values are NULL for all rows.
- First
increase the size of adjacent column datatypes, then
add the column.
- Add
the column, populate the column, then add the NOT
NULL constraint.
-
Which line of the following statement will produce an
error?
-
CREATE TABLE goods
- (good_no
NUMBER,
-
good_name VARCHAR2 check(good_name in (SELECT name
FROM avail_goods)),
-
CONSTRAINT pk_goods_01
-
PRIMARY KEY (goodno));
- There
are no errors in this statement.
-
MAXVALUE is a valid parameter for sequence creation.
- TRUE
- FALSE
-
Which of the following lines in the SELECT statement
below contain an error?
-
SELECT DECODE(empid, 58385, “INACTIVE”, “ACTIVE”)
empid
- FROM
emp
- WHERE
SUBSTR(lastname,1,1) > TO_NUMBER(’S')
- AND
empid > 02000
- ORDER
BY empid DESC, lastname ASC;
- There
are no errors in this statement.
-
Which function below can best be categorized as similar
in function to an IF-THEN-ELSE statement?
- SQRT
-
DECODE
-
NEW_TIME
-
ROWIDTOCHAR
-
Which two of the following orders are used in ORDER BY
clauses? (choose two)
- ABS
- ASC
- DESC
- DISC
- You
query the database with this command
SELECT
name
FROM employee
WHERE name LIKE ‘_a%’;
Which
names are displayed?
- Names
starting with “a”
- Names
starting with “aR
- or
“A”
- Names
containing “aR
- as
second character
- Names
containing “aR
- as
any letter except the first
|
|
|