Database object names and prefixes

The name of every database object is an identifier.

For information about the rules for valid identifiers, see Identifiers.

In queries and sample SQL statements throughout this book, database objects from the sample database are generally referred to using their simple name. For example:

SELECT *
FROM Employees;

Tables, procedures, and views all have an owner. The DBA user ID owns the tables in the sample database. In some circumstances, you must prefix the object name with the owner user ID, as in the following statement.

SELECT *
FROM DBA.Employees;

The Employees table reference is said to be qualified. In other circumstances it is enough to give the object name. This section describes when you need to use the owner prefix to identify tables, views and procedures, and when you do not.

When referring to a database object, you require a prefix unless:

  • You are the owner of the database object.

  • The database object is owned by a group ID of which you are a member.

 Example
Note

Joe and Sally do not have any extra permissions because of their membership in the company group. The company group has not been explicitly granted any table permissions. (The company user ID has implicit permission to look at tables like Salaries because it created the tables and has DBA authority.) So, Joe and Sally still get an error executing either of these commands:

SELECT *
FROM Salaries;
SELECT *
FROM company.Salaries;

In either case, Joe and Sally do not have permission to look at the Salaries table.