Tag: databases

Questions Related to databases

Which one is PL/SQL (but not SQL) datatype

  1. LONG

  2. NUMBER

  3. INTEGER

  4. REF


Correct Option: C
  1. CHARACTER

  2. NUMBER

  3. INTEGER

  4. REAL


Correct Option: A,C,D
  1. SELECT FROM GROUP BY WHERE

  2. SELECT FROM GROUP BY ROLLUP

  3. SELECT GROUP BY FROM

  4. SELECT WHERE FROM GROUP BY


Correct Option: B

NULL values violate CHECK constraint

  1. True

  2. False


Correct Option: B
  1. ON DELETE SET NULL

  2. ON DELETE CASCADE

  3. ON DELETE DELETE

  4. ON DELETE RESTRICT


Correct Option: B
Explanation:

To answer this question, the user needs to have knowledge of database management systems and the concept of Foreign Keys.

When a Foreign Key references a Primary Key in another table, there is a possibility that the referenced record(s) may be deleted. In such cases, four actions can be taken: SET NULL, CASCADE, DELETE, or RESTRICT.

  • ON DELETE SET NULL: This option sets the Foreign Key value to NULL when the referenced record(s) are deleted. This may lead to data integrity issues and is not ideal in most cases.

  • ON DELETE CASCADE: This option deletes all the dependent rows in the child table when the referenced rows in the parent table are deleted. This is usually the preferred option when the child rows are no longer relevant without the parent rows.

  • ON DELETE DELETE: This syntax does not exist, and hence, it is incorrect.

  • ON DELETE RESTRICT: This option prevents the deletion of the referenced rows in the parent table when there are dependent rows in the child table. This is useful when the data in the child table is still relevant and associated with the data in the parent table.

Therefore, the correct answer is:

The Answer is: B. ON DELETE CASCADE

  1. Restricts the length of the String

  2. Replaces a sequence of characters in a string with another set of characters

  3. Modifies the datatype of a column

  4. Renames a column


Correct Option: B