Conventions needed for Labs 2-6
MIS 421 has certain conventions to which projects
are expected to conform. Most are
naming conventions intended to make your database easier for
other people to understand. Other conventions are designed to
keeping your team projects organized and uncluttered.
General Naming Conventions:
- Names describe the content meaningfully and concisely. e.g.,
tblPerson is both meaningful and concise.
tblData is not meaningful.
MembersOfTheAssociationTable is not concise.
- Capitalize the first character of each distinct word, but use lower case
for prefixes, e.g.,
vuePersonLanguageSkill
- Spell with letters and numbers only. Numbers should be used sparingly. .
- Abbreviations should be used sparingly. However, abbreviated
object prefixes are often helpful, e.g.
tbl , vue .
- No spaces. The underscore character "_" is normally to
be used only in the requirement numbers and database names,
e.g.
vuePerson_2_75 or QYY_DBName_Owner
Required elements and the naming conventions in Conceptual, Logical and Physical data models (Examples are in red italics in the table below ):
| Conceptual data model | Logical data model | Physical data model |
Entity/Table Name
| Entity name: use singular noun. Capitalized first character of each word
BookBuyer
| Entity name: use singular noun. Capitalized first character of each word
BookBuyer | Table name: use singular noun with 'tbl' prefix. Capitalized first character of each word
tblBookBuyer |
Identifier Name | Entity name, plus 'ID'
BookBuyerID | Entity name, plus 'ID'
BookBuyerID | Not applicable |
Primary key Name | Not applicable | Not applicable | Table name without 'tbl' prefix, plus 'ID'
BookBuyerID |
Attribute Name | Not applicable | Capitalized first character of each word (See below for Boolean attribute)
LicenseNumber
isTaxExempt | Capitalized first character of each word (See below for Boolean column)
LicenseNumber
isTaxExempt |
Foreign key Name | Not applicable | Not applicable | FK name is identical to the name of the PK of the primary key table (parent table).
SupplierID |
Conventions for Naming Specific Types of Objects
- Database Names:
-
QYY_DBName_Owner, where ...
- QYY is the Quarter and Year
- The DBName will usually be indicated
in the instructions you are given
- The Owner will usually be your team
name or your family name
e.g.
Individual db: S23_QACS_Smith for "Spring 2023",
"Queen Anne Curiosity Shop", student name "Smith"
Team db: W23_SCA_Rabbit for Winter 2023,
Sister Cities Association , team "Rabbit"
- Use these prefixes (all in lower case) for tables, views
and scripts:
- tbl - for tables – e.g.,
tblPerson
- vue - for views – The view name should reflect
the view’s purpose and
[req#] – e.g.,
vuePerson_3_30 , vueFrmPerson_3_30
- script - for scripts:
- plus the lab # associated with the script
- plus a word or phrase that describes the
action performed
- e.g.,
scriptLab2CreateTblPerson
- Table Names
- Singular nouns are preferred for table names:
tblPerson ,
not tblPersons
or tblPeople .
- Simple, yet as meaningful as possible.
tblCity is simple,
but is this a list of local
cities? Or of Sister cities? It's not clear.
tblSCACity : "SCA" stands for
"Sister City Association" which is not helpful here. Why?
Because this is the SCA database, so "SCA" does not distingush
one table from another.
tblSisterCity
would the clearest, most understandable name since it
clearly identifies the content of the table, but is
still reasonably concise.
- Tables that are "associative entities" will normally be
named after the two (or more) entities they join together – e.g.
tblCommitteePerson would sit between tblCommittee
and tblPerson.
- Field Names in tables and views
- Prefix not required, but allowed if useful for clarity.
- Primary key fields that are identity type
(self-incrementing integer fields:
1, 2, 3, ...) will take the table name (less the prefix)
and the characters “ID” in upper case, – e.g.
SisterCityID for the PK field of
tblSisterCity .
- Foreign keys will normally have the same name as
the primary key field in the table to which they
refer (e.g.
SisterCityID when
used as a foreign key).
- Special Names for Fields:
- Most attribute (field) names are noun phrases,
e.g. LastName , OldPrice
or DateOfBirth .
-
However, fields with a Boolean
datatype may be more readable as an adjective phrase
(e.g.
Complete , ShippingIncluded or
Taxable ) or as a verb phrase (e.g.
IncludesShipping ,
isTaxable or
HasView )
- View Names
- Append the Requirement ID to the name of all views.
For example, the view required by
[req 2.90] in the
Lab 2 instructions must end as shown here:
vuePersonMembership_2_90 .
- Views are SELECT statements that have been stored by name
by the DBMS (e.g.
vueTblPerson_2_30) . A view can be referenced
in another view by its name.
- Views that were designed for a specific table, form, report, control,
or document may be named after the object they support –
e.g.
vueTblMembership_3_110 , vueFrmMembership_3_110 ,
vueDocWelcomeLetter_2_90
- Views that combine data from multiple tables may be named
after the entities they associate – e.g.,
vuePersonMembership_3_230
- ERDs and Data Models:
Example names would be for Lab 3 ...
TeamName_Lab3.vsdx for the Visio
Data Model in SCA Lab 3
TeamName_Lab3.mwb for the MySQL
Workbench ERDs in SCA Lab 3
ERD_Lab_3
for the SQL Server ERD diagrams in Lab 3
The notes above should get you through Labs 2-6.
|