Multiple choice technology databases

The database administrator of your company created a public synonym 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? SELECT * FROM HR;

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

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

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

  4. You obtain the results retrieved from both the public synonym HR and the HR table that belongs to

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

When a table name exists in both your local schema and as a public synonym, SQL always gives priority to the local schema table. The database first looks for objects in your own schema before checking public synonyms. This means your query will return data from your own HR table, not the public synonym pointing to HUMAN_RESOURCES.