Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Database Questions

Q1) When designing a database table, how do you avoid missing column values for
non-primary key columns?
a) Use UNIQUE constraints
b) Use PRIMARY KEY constraints
c) Use DEFAULT and NOT NULL constraints
d) Use FOREIGN KEY constraints
e) Use SET constraints

Q2) Which of the following constraints can be used to enforce the uniqueness of
rows in a table?
a) DEFAULT and NOT NULL constraints
b) FOREIGN KEY constraints
c) PRIMARY KEY and UNIQUE constraints
d) IDENTITY columns
e) CHECK constraints

Q3) Which one of the following correctly selects rows from the table myTable that
have null in column column1?
a) SELECT * FROM myTable WHERE column1 is null
b) SELECT * FROM myTable WHERE column1 = null
c) SELECT * FROM myTable WHERE column1 EQUALS null
d) SELECT * FROM myTable WHERE column1 NOT null
e) SELECT * FROM myTable WHERE column1 CONTAINS null

Q4) Which of the following commands is used to change the structure of table?
a) CHANGE TABLE
b) MODIFY TABLE
c) ALTER TABLE
d) UPDATE TABLE

Q5) Which statement is true regarding the UNION operator?


a) By default, the output is not sorted.
b) NULL values are not ignored during duplicate checking.
c) Names of all columns must be identical across all SELECT statements.
d) The number of columns selected in all SELECT statements need not be the same.
Q6) The ORDERS table belongs to the user OE. OE has granted the SELECT privilege
on the ORDERS table to the user HR. Which statement would create a synonym
ORD so that HR can execute the following query successfully? SELECT * FROM
ord;
a) CREATE SYNONYM ord FOR orders; This command is issued by OE.
b) CREATE PUBLIC SYNONYM ord FOR orders; This command is issue by OE.
c) CREATE SYNONYM ord FOR oe.orders; This command is issued by the database
administrator.
d) CREATE PUBLIC SYNONYM ord FOR oe.orders; This command is issued by the
database administrator.

Q7) Evaluate the following SQL statement:


SQL> SLEECT cust_id,cust_last_name FROM customers WHERE cust_credit_limit IN
(SELECT cust_credit_limit FROM customers WHERE cust_city='Singapore');
Which statement is true regarding the above query if one of the values generated
by the subquery is NULL?
a) It produces an error
b) It generates output for NULL as well as the other values produced by the
subquery.
c) It executes but returns no rows.
d) It ignores the NULL value and generates output for the other values produced by
the subquery.

Q8) The PART_CODE column in the SPARES table contains the following list of
values: PART_CODE ------A%_WQ123A%BWQ123AB_WQ123 Evaluate the following
query:
SQL> SELECT part_code FROM spares WHERE part_code LIKE
'%\%_WQ12%'ESCAPE'\';
Which statement is true regarding the outcom of the above query?
a) It produces an error.
b) It display all values
c) It displays only the values A%_WQ123 and AB_WQ123.
d) It displays only the values A%_WQ123 and A%BWQ123.
e) It displays only the values A%BWQ123 and AB_WQ123.

Q9) When does a transaction complete?(Choose all that apply)


A. When a DELETE statement is executed.
B. When a ROLLBACK command is executed.
C. When a PL/SQL anonymous block is executed.
D. When a data definition language (DDL) statement is executed.
E. When a TRUNCATE statement is executed after the pending transaction.
a) A,B,D
b) C,D,E
c) A,D
d) B,C,D,E
e) B, D,E

Q10) Which two statements are true regarding single row functions?
A. They accept only a single argument.
B. They can be nested only to two levels.
C. Arguments can only be column values or constants.
D. They always return a single result row for every row of a queried table.
E. They can return a data type value different from the one that is referenced.

a) A,B
b) B,E
c) D,E
d) A,C
e) A,E

Q11) Which describes the default behavior when you create a table?
a) The table is accessible to all users.
b) Tables are created in the public schema.
c) Tables are created in your schema.
d) Tables are created in the DBA schema.

Q12) Which of the following queries can you use to search for employees with the
pattern 'A_B' in their names?
a) SELECT last_name FORM employees WHERE last_name LIKE '%A\_B%'ESCAPE'\\';
b) SELECT last_name FORM employees WHERE last_name LIKE '%A_B%'ESCAPE;
c) SELECT last_name FORM employees WHERE last_name LIKE '%A_B%'ESCAPE'%';
d) SELECT last_name FORM employees WHERE last_name LIKE '%A\_B%'ESCAPE'\';

Q13) Which statement is in correctly describe functions that are available in SQL?
a) DECODE translates an expression after comparing it to each search value
b) NVL2 compares two expressions and returns null if they are equal, or the first
expression if they are not equal.
c) NAL compares two expressions and returns null if they are equal, or the first
expression if they are not equal
d) NULLIF compares two expressions and returns null if they are equal, or the first
expression if they are not equal.

Q14) Auto commit occurs on which of the following situations?


a) On any DML
b) On any DDL
c) Up on staring
d) On DML & on DDL

Q15) What is read into the Database Buffer Cache from the data files?
a) Rows
b) Changes
c) Blocks
d) SQL

Q16) Which initialization parameter specifies the location of the alert log file?
a) UTL_FILE_DIR
b) USER_DUMP_DEST
c) LOG_ARCHIVE_DEST
d) BACKGROUND_DUMP_DEST

Q17) Study this statement:


SELECT ename FROM emp UNION ALL SELECT ename from ex_emp;
In what order will the rows be returned?
a) The rows from each table will be grouped and within each group will be sorted on
ENAME.
b) The rows from each table will be grouped but not sorted.
c) The rows will not be grouped but will all be sorted on ENAME.
d) The rows will be neither grouped nor stored.

Q18) User JOHN updates some rows but not commit the changes. User ROOPESH
queries the rows that JOHN updated. Which of the following statements is true?
a) ROOPESH will not be able to see the rows because they will be locked.
b) ROOPESH will be able to see the new values, but only if he logs in as JOHN.
c) ROOPESH will see the old versions of the rows.
d) ROOPESH will see the state of the state of the data as it was when JOHN last
created a SAVEPOINT.

Q19) A UNIQUE constraint on a column requires an index. Which of the following


scenarios is correct?
a) If a UNIQUE index already exists on the column, it will be used.
b)If a NONUNIQUE index already exists it will be used.
c) IF a NONUNIQUE index already exists on the column, a UNIQUE index will be
created implicitly.
d) If any index exists on the column, there will be an error as Oracle attempts to
create another index implicitly.

Q20) Which of the following statements are syntactically correct? (Choose all that
apply.)
a) SELECT E.EMPLOYEE_ID, J.JOB_ID PREVIOUS_JOB, E.JOB_ID CURRENT_JOB FROM
JOB_HISTORY J CROSS JOIN EMPLOYEES E ON (J.START_DATE=E.HIRE_DATE);
b) SELECT E.EMPLOYEE_ID, J.JOB_ID PREVIOUS_JOB, E.JOB_ID CURRENT_JOB
FROM JOB_HISTORY J JOIN EMPLOYEES E ON (J.START_DATE=E.HIRE_DATE);
c) SELECT E.EMPLOYEE_ID, J.JOB_ID PREVIOUS_JOB, E.JOB_ID CURRENT_JOB
FROM JOB_HISTORY J OUTER JOIN EMPLOYEES E ON (J.START_DATE=E.
HIRE_DATE);
d) None of the above

- End -

You might also like