Question 1
Every Oracle database contains the public synonym `DUAL`, which points at the table `SYS.DUAL`. Working in a session that owns the HR schema, you want a single query that returns exactly one row whose single value is the name of the schema that owns the *base object* behind that public synonym — that is, the value `SYS`. Which query does that?
A. SELECT table_name FROM all_synonyms WHERE owner = 'PUBLIC' AND synonym_name = 'DUAL'
Confuses TABLE_NAME with TABLE_OWNER. In ALL_SYNONYMS the base object is described by two separate columns — TABLE_OWNER is its schema, TABLE_NAME is its name — so this returns the object name DUAL, not the owning schema.
B. SELECT table_owner FROM all_synonyms WHERE owner = 'PUBLIC' AND synonym_name = 'DUAL'Correct answer
A public synonym is owned by the user group PUBLIC, so it is visible in ALL_SYNONYMS with OWNER = 'PUBLIC'; TABLE_OWNER holds the schema of the object the synonym points to, giving the single value SYS.
C. SELECT table_owner FROM user_synonyms WHERE synonym_name = 'DUAL'
Assumes a public synonym is visible to the current user through USER_SYNONYMS. USER_SYNONYMS lists only private synonyms owned by the current user; a public synonym belongs to PUBLIC, not to you, so this returns no rows.
D. SELECT owner FROM all_synonyms WHERE owner = 'PUBLIC' AND synonym_name = 'DUAL'
Confuses the owner of the synonym with the owner of the object it names. OWNER describes the synonym itself, so for any public synonym this always returns the literal PUBLIC rather than SYS.
Explanation
CREATE PUBLIC SYNONYM creates a synonym in the user group PUBLIC rather than in any user's own schema, so the dictionary records it with OWNER = 'PUBLIC' and it never appears in USER_SYNONYMS, which is restricted to synonyms the current user owns. Within a synonym row, the synonym and its target are described by different column pairs: OWNER/SYNONYM_NAME identify the synonym, while TABLE_OWNER/TABLE_NAME identify the object it resolves to. Selecting the target schema therefore means reading TABLE_OWNER from ALL_SYNONYMS (or DBA_SYNONYMS), not OWNER and not TABLE_NAME.