Fully Qualify Your Database Object Names

Now, this is a commonly ignored point; in fact, all the sample code I’ve demonstrated in this tutorial has essentially violated this tip. In terms of database development, a fully qualified object name looks as follows:¬†DATABASE.schema.TABLE. Now, let’s look at why fully qualified names are important, and in what situations they are necessary.¬†The purpose of a fully qualified object name is to eliminate ambiguity.¬†Beginning developers rarely have access to multiple databases and schemas, which complicates the issues in the future. When a given user has access to multiple databases, multiple schemas, and the tables therein, it becomes crucial to directly specify what the user is attempting to access. If you have an employee table, your boss has an employee table, and the schema that your web application is running on has an employee table, which are you really attempting to access?

Logically, the fully qualified name would look like DATABASE.SCHEMA.OBJECTNAME, however, syntactically (ie, in executable statements), it would simply be SCHEMA.OBJECTNAME. Although various DBMSes do have various syntax differences, the above style is generally applicable.

Fully qualifying your database names is important when working with databases that are larger and are used by multiple users and contain multiple schemas. However, it is a good habit to get into.

Leave a Reply

Your email address will not be published. Required fields are marked *