Introduction




About this Document

This document is intended for professionals working with relational databases at Stanford University. It describes the naming conventions - standards and guidelines - to be used for naming database objects. For each object to be named, it is indicated if the naming convention is a guideline. If there is no specific mention it is a standard by default.

It covers naming conventions for Sybase as well as Oracle database objects. Wherever possible, the guidelines are kept consistent for both DBMSs.

In the case of an application software package, the convention should be adhered to as much as possible. However, it is not warranted to customize the application software package solely to meet these naming conventions.


Change Log

1.0 12/29/95 First draft version
2.0 3/7/96 Reviewed with all DBAs; Total revision; no side bars added.
2.1 4/12/96 Minor changes; added convention for Oracle archive files
2.2 4/25/96 removed identifying suffixes (constants)
2.3 8/21/96 Changes to name of Oracle archive files|



General Guidelines for naming


Conventions


Sybase Naming Conventions


 

SQL Servers

name is a meaningful name describing the application type(s) running on the server,
vvv represents the version of the server.


dev for development

ppd for pre-production

prd for production

cnb for crash and burn

Examples

txn_dev

adhoc_prd


Databases

aaa is a meaningful three character abbreviation for the applicationusing this database.
It should be the three character name assigned for ECS/Control-M
v is a one character, alphanumeric version indicator (optional)
ttt is the three character indication of the environment, and use of this database


dev for development

ppd for pre-production

prd for production

cnb for crash and burn

Examples:

ood_5_dev

ams_1_rpt

ehs_trn

 


Tables


Views


Columns


Indexes

tablename

is the name of the table the index is defined for

u

is a constant indicating a unique index (otherwise omitted)

c

is a constant indicating a clustered index (otherwise omitted)

idx

is a constant indicating that the object is an index

n

is a sequential identifier where 1 indicates the index on the primary key, and 2 and higher are used for all other indexes



User-defined data types

ss is a code representing the Sybase system data type (see below) upon which the user-defined data type is built
name is a descriptive and meaningful name
typ is a constant indicating the object is a user-defined data type

 

CODE Sybase system type
in int
si smallint
ti tinyint
nm numeric
dc decimal
fl float
re real
dp double precision
mo money
sm small money
ch char
vc varchar
bi binary
vb varbinary
bt bit
dt datetime
sd smalldatetime
tx text
im image


Physical Data Types


ANSI Standard Sybase Type Physical Format
CHAR(n) CHAR(n) max 255 characters
CHAR VARYING(n) VARCHAR(n ) max 255 characters
CHAR VARYING(n) LONG VARCHAR max 2gb characters
NUMERIC(p,s) NUMERIC(p,s) precision = 1 thru 38
scale = 0 thru 38
NUMERIC(p,s) DECIMAL (p,s) precision = 1 thru 38
scale = 0 thru 38
FLOAT(p) FLOAT(p) 4 or 8 bytes
REAL REAL max 4 bytes
DOUBLE PRECISION DOUBLE PRECISION max 8 bytes
n/a MONEY max 8 bytes
n/a SMALLMONEY max 4 bytes
n/a BINARY(n) max 255 bytes
n/a VARBINARY(n) max 255 bytes
n/a BIT 8 per byte
INTEGER INTEGER 4 byte integer
SMALLINT SMALLINT 2 byte integer
SMALLINT TINYINT 1 byte integer
n/a DATETIME 8 bytes
n/a SMALLDATETIME 4 bytes
n/a TEXT(n) max 2gb characters
n/a IMAGE max 2gb binary datA


Rules

name is a descriptive and meaningful name
rul is a constant indicating that the object is a rule


Defaults

name is a descriptive and meaningful name
def is a constant indicating that the object is a default


Constraints

tablename is a the tablename of the table to which this constraint belongs
c represents a constant included if the constraint is implemented as a clustered index (omitted if nonclustered; not applicable for check constraints)
type indicates the type of constraint
Examples include: chk for check constraints
unqfor unique constraints
pky for primary key constraints


Triggers

tablename is a name of the affected table
d indicates trigger is defined for delete (otherwise omitted)
i indicates trigger is defined for insert (otherwise omitted)
u indicates trigger is defined for update (otherwise omitted)
trg is a constant indicating that the object is a trigger



Stored Procedures

 

name gives the name(s) of the objects upon which the procedure is carried out
action indicates the main action or business rule implemented by the stored procedure
proc is a constant indicating that the object is a stored procedure



SQL Server logins and Sybase Users



Database Devices (Logical)

devicetype represents the database device type
Examples include: log for transaction log device
data for data device
n is a sequential identifier beginning with 1


Segments


Oracle Naming Conventions


SIDs and Databases

AAA is a meaningful three character abbreviation for the application using this database. It should be the three character name assigned for ECS/Control-M
n is a one character alphanumeric version indicator (optional)
TTT is a meaningful indication of the version, environment and use of the database. Examples are: DEV for development, PPD for pre-production, PRD for production, RPT for reporting, TRN for training and CNB for crash and burn.


Tables


Views


Columns


Indexes


Physical Data Types

 

ANSI Standard Oracle Type Physical Format
CHAR(n) CHAR(n) max 255 characters
CHAR VARYING(n) VARCHAR2(n) max 2000 characters
n/a LONG max 2gb characters
NUMERIC(p,s) NUMBER(p,s) precision = 1 thru 38
scale = -84 thru 127
DECIMAL(p,s) NUMBER (p,s) precision = 1 thru 38
scale = -84 thru 127
FLOAT(p) NUMBER precision = 38
REAL NUMBER precision = 38
DOUBLE PRECISION NUMBER precision = 38
INTEGER NUMBER(38) precision = 38
SMALLINT NUMBER(38) precision = 38
n/a DATE 8 bytes
n/a RAW max 2000 binary data
n/a LONG RAW max 2gb binary data
n/a ROWID


Constraints

 

tablename is the name of the table to which the constraint applies
type identifies the type of constraint and can only be:
p for primary key f for foreign key
c for check constraint
desc adds additional information on the columns named in the constraint or their usage



Triggers

 

tablename is the name of the table to which the trigger is applied
x identifies the time of the trigger and can only be:
b for before
a for after
y identifies the type of trigger and can only be:
d for delete
i for insert and
u for update
trg is a constant



Stored Procedures


Packages

 

name is a meaningful name for the stored procedures it contains
pkg is a constant



Roles

 

name is a descriptive name  
rol is a constant  



Profiles

 

name is a descriptive name
prf is a constant



Tablespaces

 

name is a meaningful name for the usage of the tablespace
type is the type of tablespace
Examples are: d for data and x for index.


Rollback Segments

 

rbs identifies this object as a rollback segment
nn is a unique number from 01 to 99 (include leading zero for sorting )



Data Files

 

tablespacename is the name of the associated tablespace
SIDNAME is the name of the SID/ database
nn is a unique number from 01 to 99 (include leading zero for sorting)
dbf is a constant



Control Files

 

SIDNAME is the name of the SID/database
n identifies a number of 1 or higher
ctl is a constant



Redo log Files

 

redo is a constant
groupnn is the number of the redo log group (betw 01 & nn)
membernn is the number of the redo log members (betw 01 & maxlogfiles)
log is a constant



Parameter Files

init is a constant
SIDNAME is the name of the SID/database
ora is a constant



Archive Files

oracle is a constant
SIDNAME is the name of the SID/database
n is the thread number (between 1 & n)
m is the sequence number (between 1 & n)
arc is a constant



Service Names



Database Links


Snapshot Names

 

SIDNAME is the same as the SID or database name of the source system
tablename is the name of the table from which a snapshot is created


Summary of Naming Conventions

Sybase

Object Type   Object Naming convention   Examples
SQL Servers   name_vvv   adhoc_prd, txn_dev
Databases   aaa[_v]_ttt   dems_3_dev, ehs_trn
Tables   eeee_eeee_eeee   sales_detail
Views   vvvv_vvvv_vvvv_v   sales_by_product_v
Columns   aaaa_aaaa_aaaa   employee_number
Indexes   tablename_[u][c]_idx_n   fin_roll_summary_uc_idx_1
User-defined data types   ss_name   in_branch_number
Rules   name   branch_number
Defaults   name   commission_percentage
Constraints   tablename_[c]_type   carrier_pky, employee_c_unq
Triggers   tablename_[d][i][u]   air_segment_i
Procedures   name_action   carrier_get
Server logins and Users   f[m]lllll   mhart, mtpuff
Database device (logical)   devicetype_n   log_1, data_5
Segments   index_n, data_n, objectname_n   index_1, data_23, person_1
         

ORACLE

Object Type   Object Naming convention   Examples
SIDs and Databases   AAA[n]_VVV   OOD1_DEV, AMS_RPT
Tables   eeee_eeee_eeee   sales_detail
Views   vvvv_vvvv_vvvv_v   sales_by_product_v
Columns   aaaa_aaaa_aaaa   employee_number
Indexes   tablename_[u][c]_idx_n   fin_roll_summary_uc_idx_1
Constraints   tablename_type_desc   emp_p_empno
Triggers   tablename_x_y   employee_b_di
Stored Procedures   name_action   carrier_get
Packages   name   employee_maint
Roles   name   security_admin
Profiles   name   adhoc_rpt
Tablespaces   nametype   gldetaild, glsummaryx
Rollback Segments   rbsnn   rbs05
Data Files   <dirname>tblspacename_SIDNAME_nn.dbf   ...gldetaild_FIN1_DEV_01.dbf
Control Files   <dirname>SIDNAME_nn.ctl   ...FIN1DEV_01.ctl
Redo Log Files   <dirname>redo_groupnn_membernn.log   ...redo_01_02.log
Parameter Files   <dirname>initSIDNAME.ora   ...initFIN1DEV.ora
Archive Files   <dirname>/oracle_SIDNAME_n_m.arc   ...OOD1_DEV_1_2.arc
Service Names   SIDNAME   OOD1_DEV, AMS_RPT
Database Links   SIDNAME   OOD1_DEV, AMS_RPT
Snapshot Names   SIDNAME_tablename   OOD1_DEV_donor