Re: column prefixes

From: Jeffery Cann <jcann_at_fairway_NO_SPAM_.com>
Date: 1998/02/20
Message-ID: <34EE104A.77D23BAD_at_fairway_NO_SPAM_.com>#1/1


suhasu_at_hotmail.com wrote:
>
> Hi,
>
> Are there any pros/cons to having table identifying
> prefixes to column names???

I think prefix usage is redundant and goes against the idea of a relational database using meaningful identifiers for tables and colums. What good is a database where you cannot remember the column names? (rhetorical)

>
> I have seen database applications where the column names in a
> table have a 2-4 letter prefix distinguishing similar column
> entities in different tables..
> EMPLOYEE Table
> em_employee_code (code of the employee)
> em_employee_name (name of the employee)
> em_dept_code (department code for the employee)
> em_create_date (timestamp)
>
> DEPARTMENT Table
> de_dept_code (code for department)
> de_dept_name (name for department)
> de_create_date (timestamp)

In my opinion, it is better to use names like:

EMPLOYEE TABLE
  EMPLOYEE_CODE
  EMPLOYEE_NAME
  DEPARTMENT_CODE DEPARTMENT TABLE
  DEPARTMENT_CODE
  DEPARTMENT_NAME (btw-your "timestap" runs contrary to the idea of normalization of data. i.e., the point of a releational database is that you don't repeat data in rows. Maybe a column like HIRE_DATE would be more useful.)

>
> Thus for a sql to obtain all employees working for
> departments whose name begins with 'SOC' we will have
>
> SELECT distinct em_employee_code
> FROM employee, department
> where em_dept_code = de_dept_code
> and de_dept_name = 'SOC%';

Why not use aliases to abbreviate, rather than prefixes? (eg emp and dep)

select distict employee
  from employee emp, department dep
  where emp.department_code = dep.department_code   and dep.department_code like 'SOC%';

Jeff

-- 
Jeffery Cann
Senior Software Engineer
Fairway Systems, Inc.

/* remove the _NO_SPAM_ to reply */
-- 
Senior Software Engineer
Fairway Systems, Inc.

/* remove the _NO_SPAM_ to reply */
Received on Fri Feb 20 1998 - 00:00:00 CET

Original text of this message