SQL Table Names

by Vickram H 2012-07-30 12:07:38

SQL Table Names

When you specify a table name in a SQL statement, SQL assumes that you are referring to one of your own tables (that is, a table that you created). Usually, you will want to choose table names that are short but descriptive. The table names in the sample database (ORDERS, CUSTOMERS, OFFICES, SALESREPS) are good examples. In a personal or departmental database, the choice of table names is usually up to the database developer or designer.

In a larger, shared-use corporate database, there may be corporate standards for naming tables, to insure that table names do not conflict. In addition, most DBMS brands allow different users to create tables with the same name (that is, both Joe and Sam can create a table named BIRTHDAYS). The DBMS uses the appropriate table, depending on which user is requesting data. With the proper permission, you can also refer to tables owned by other users, by using a qualified table name. A qualified table name specifies both the name of the table's owner and the name of the table, separated by a period (.).

For example, Joe could access the BIRTHDAYS table owned by Sam by using the qualified table name:
SAM.BIRTHDAYS
A qualified table name generally can be used in a SQL statement wherever a table name can appear.

The ANSI/ISO SQL2 standard generalizes the notion of a qualified table name even further. It allows you to create a named collection of tables, called a schema. You can refer to a table in a specific schema using a qualified table name.
For example, the BIRTHDAYS table in the EMPLOYEEINFO schema would be referenced as:
EMPLOYEEINFO.BIRTHDAYS

Tagged in:

803
like
0
dislike
0
mail
flag

You must LOGIN to add comments