Multiple choice technology databases

The database administrator of your company created a public synonum called HR for the HUMAN_RESOURCES table of the GENERAL schema, because many users frequently use this table. As a user of the database, you created a table called HR in your schema. What happens when you execute this query?

  1. You obtain the results retrieved from the public synonym HR created by the DBA.

  2. You obtain the results retrieved from the HR table that belongs to you schema.

  3. You get an error message because you cannot retrieve from a table that has the same name as a public synonym.

  4. You obtain the results retrieved from both the publich synonym HR and the HR table that belongs to your schema, as a Cartesian product.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Oracle database name resolution, when a reference is ambiguous (could refer to a local object or a public synonym), the local schema objects take precedence. Your own HR table in your schema will be accessed instead of the public synonym HR that points to GENERAL.HUMAN_RESOURCES.

AI explanation

When a private object (a table in your own schema) has the same name as a public synonym, Oracle's name resolution gives priority to the object in your own schema before checking public synonyms. So querying 'HR' resolves to your own HR table, not the public synonym pointing to HUMAN_RESOURCES, and no error or Cartesian product occurs — it's a straightforward local-object-wins precedence rule.