Database Concepts and SQL Functions

Test your knowledge of database fundamentals including views, constraints, joins, subqueries, and Oracle SQL functions like DECODE, NVL, NVL2, NULLIF, and date operations.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which character is used to continue a statement in SQL*Plus?

  1. *
  2. /
  3. -
  4. @
Question 2 Multiple Choice (Single Answer)

Assuming today is Monday, 10 July 2000, what is returned by this statement: SELECT to_char(NEXT_DAY(sysdate, 'MONDAY'), 'DD-MON-RR') FROM dual;

  1. 17-JUL-00
  2. 11-JUL-00
  3. 09-JUL-00
  4. 03-JUL-00
Question 3 Multiple Choice (Single Answer)

SELECT NULLIF('testing','testing') FROM DUAL ;

  1. testing
  2. True
  3. null
  4. error
Question 4 Multiple Choice (Single Answer)

SELECT NULLIF(NULL,'testing') FROM DUAL ;

  1. testing
  2. True
  3. null
  4. error
Question 5 Multiple Choice (Single Answer)

SELECT NVL2(null,'second','third') FROM DUAL ;

  1. second
  2. third
  3. null
  4. error
Question 6 Multiple Choice (Single Answer)

SELECT NVL2('first','second','testing') FROM DUAL ;

  1. third
  2. null
  3. second
  4. error
Question 7 Multiple Choice (Single Answer)

SELECT NVL(null,'testing') FROM DUAL ;

  1. testing
  2. null
  3. False
  4. error
Question 8 Multiple Choice (Single Answer)

select decode('a','b','value-b','d','value-d','a','value-a','NA') result from dual;

  1. NA
  2. value-d
  3. value-b
  4. value-a
Question 9 Multiple Choice (Multiple Answers)

What is true about subqueries ?

  1. A single row subquery can retrieve data from only one table.
  2. A SQL query statement cannot display data from table B that is referred to in its subquery,unless table B is included in the main query's FROM clause.
  3. A SQL query statement can display data from table B that is referred to in its subquery, without including table B in its own FROM clause
  4. A single row subquery can retrieve data from more than one table.
Question 10 Multiple Choice (Single Answer)

What is true about an equijoin?

  1. You can join a maximum of two tables through an equijoin.
  2. You can join a maximum of two columns through an equijoin.
  3. You can join n tables (all having single column primary keys) in a SQL statement by specifying a minimum of n-1 join conditions.
  4. To join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns.
  5. You specify an equijoin condition in the SELECT or FROM clauses of a SELECT statement.
Question 11 Multiple Choice (Single Answer)

What type of object privileges can be granted on a view?

  1. DELETE, INSERT,SELECT
  2. DELETE, INSERT, SELECT, UPDATE
  3. ALTER, DELETE, INSERT, SELECT
  4. NONE
Question 12 Multiple Choice (Multiple Answers)

Two reasons to create table alias :

  1. You have too many tables.
  2. You have too many columns in your tables.
  3. You want to work on your own tables.
  4. You want to use another schema's tables.
  5. Your tables have difficult names.
  6. Your tables are too long.
Question 13 Multiple Choice (Single Answer)

When the full outer join is used?

  1. You want all unmatched data from both tables.
  2. One of the tables has more data than the other.
  3. You want all matched data from both tables.
  4. You want all matched and unmatched data from only one table.
Question 14 Multiple Choice (Single Answer)

Which constraint can only be applied at the column level?

  1. Primary Key
  2. Check
  3. Not Null
  4. Unique
Question 15 Multiple Choice (Single Answer)

What is true about WHERE clause ?

  1. A WHERE clause can be used to restrict rows only.
  2. A WHERE clause CANNOT be used in a query if the query uses a HAVING clause.
  3. WHERE clause can be used to restrict both rows and groups.
  4. WHere clause filters the columns from the output
Question 16 Multiple Choice (Multiple Answers)

What is true about the Truncate statement?

  1. It is faster than the Delete operation.
  2. You can roll back the deletion of rows after the statement executes.
  3. You must be the owner of the table or have DELETE ANY TABLE system privileges
  4. It releases the storage space used by the table.
Question 17 Multiple Choice (Multiple Answers)

WHat is not true about the constaints ?

  1. A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.
  2. The UNIQUE constraint does not permit a null value for the column
  3. The NOT NULL constraint ensures that null values are not permitted for the column
  4. The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index
Question 18 Multiple Choice (Single Answer)

Once a sequence is created

  1. It is automatically used in all INSERT and UPDATE
  2. It is linked to a specific table.
  3. It belongs to a specific schema.
  4. It is automatically available to all users.
Question 19 Multiple Choice (Single Answer)

PRODUCT ======= Product ID Product Description Manufacturer ID MANUFACTURER ============ Manufacturer ID Manufacturer Name Referring to the above table, what type of relationship exists between the Product table and the Manufacturer table?

  1. Product - Many,Manufacturer - Many
  2. Product - One or Many,Manufacturer - One or Many
  3. Product - Many,Manufacturer - One
  4. Product - One,Manufacturer - One
  5. Product - One,Manufacturer - Many
Question 20 Multiple Choice (Single Answer)

You are writing a database application to run on your DBMS. You do not want your users to be able to view the underlying table structures. At the same time you want to allow certain update operations. Referring to the above scenario, what structure will you deploy?

  1. Cursor table
  2. Table filter
  3. Dynamic procedure
  4. View
  5. Summary table