The tag has no wiki summary.

learn more… | top users | synonyms

38
votes
10answers
3k views

Why do people recommend not using the name “Id” for an identity column?

I was taught not to use the name Id for the identity column of my tables, but lately I've just been using it anyways because it's simple, short, and very descriptive about what the data actually is. ...
13
votes
3answers
776 views

Is table aliasing a bad practice?

I remember learning to do this in a DBMS course for Master of Information Services students. To save yourself some typing, you can type: SELECT t1.id, t2.stuff FROM someTable t1 ...
13
votes
5answers
1k views

What standard should I follow when naming tables and views?

What standard should I follow when naming tables and views? For instance, is it a good idea to put something like tbl_ at the beginning of table names? Should I designate code/lookup tables in some ...
11
votes
3answers
2k views

Column name naming conventions and best practices

I would like some expert opinion on best practices when it comes to column naming. The background is that according to Wikipedia, the following syntax, SELECT ... FROM Employees JOIN Timesheets ...
10
votes
7answers
3k views

How should I best name my timestamp fields?

When I am looking to create some timestamp fields (or other date/time style fields), what is the best way to name them? Should I just put record_timestamp?
8
votes
8answers
1k views

Is there a reason to use extremely abbreviated table names?

We're using a database setup from a vendor's application that has horrifically hard to read database table names, and no documentation on what is stored where. I can see why one might want to ...
7
votes
3answers
2k views

Plural vs Singular Table Name

How should I name my Tables when creating a new database? Singular: Client or Plural: Clients?
2
votes
4answers
552 views

Should I use a Column naming convention or rely on column descriptions?

Frankly I am stunned that after some basic (very basic) internet searches I have not been able to find a comprehensive naming convention or guideline or SQL object and column naming. The parallel ...
2
votes
2answers
101 views

What is a standard or conventional name for a column representing display order? [closed]

For example, a junction table associating a product and its pictures: create table product_picture ( product_id bigint not null references product(id), picture_id bigint not null references ...
2
votes
2answers
64 views

Including the substring “_id” in column names [closed]

I have a table of Teams. Each Team has an ID. I have another table that holds Players. Each Player is assigned to a team. So my tables might look something like CREATE TABLE players ( id ...
2
votes
2answers
206 views

T-SQL Naming Standard

Is there a recommended (official or not) style from Microsoft regarding naming and casing in T-SQL? If there isn't one from Microsoft then is there one with broad acceptance?
1
vote
2answers
1k views

MySQL case sensitivity for table names

Why is it that different platforms (linux vs windows) does not support the same naming conventions? I'm stunned by the fact that the documentation uses file names as an excuse for this. Yes, windows ...
1
vote
1answer
94 views

Are there any objective reasons to prefer a prefix over a suffix for an environment-specific login?

When creating environment specific logins (development, qa, staging, production, etc.) I'm faced with the choice of making the denotation a prefix or a suffix to the login name. Examples ...
1
vote
1answer
65 views

Does the length of a table name affect performance?

PostgreSQL table names are limited to 63 chars. Is there a performance gain to be had if I limit my table names to something like 5 chars or can I use the full 63 chars without consequence? I ...
1
vote
1answer
57 views

Lookup table naming convention? [closed]

Is there a naming convention for lookup tables? I cannot see any declaration by oracle or anything consistent on google. However I assume some of you professional DBAs follow a convention? Perhaps ...
1
vote
1answer
27 views

Do shorter names exist for “one-to-many”, “one-to-one”, “many-to-many” relationships?

In terms of generic variable naming or even everyday geek discussion, do shorter and "cleaner" terms exist for one-to-one, one-to-many, and many-to-many relationships. For example, in discussion of ...
1
vote
2answers
113 views

Naming question for functions: implicit or explicit naming of grouping in function name [closed]

Requesting help with naming TSQL functions. Existing function names (see below for table and relationship descriptions) I currently have functions named as follows: ...
1
vote
1answer
88 views

Case style of tables and field (Naming Conventions)

What is best practice for naming dbs, tables (collections) and fields among DBMSs? I mean casing style, for example AaaBaa,aaa-bbb, aaa_bbb, AAA-BBB, aaaBbb, ... I think if one exists it should be ...
1
vote
0answers
82 views

What's the name for a script that can be executed any number of times with the same final result? [closed]

For example, in T-SQL: IF NOT EXISTS (SELECT * FROM sys.server_principals WHERE name = 'myLogin') BEGIN CREATE LOGIN [myLogin] WITH PASSWORD = ...
1
vote
0answers
112 views

Naming the parts of a supertype/subtype pattern

I am doing more extensive work with supertyping and subtyping as it solves some problems in a very useful way. In particular, I am enhancing a web application where many things need to be subject to ...
0
votes
2answers
171 views

Naming foreign key columns

Now I hear that the best practice for naming foreign key columns is the name of the table and field (and maybe the function if there are multiple foreign keys to the same table), for example, a ...
0
votes
1answer
42 views

Name for SELECT equivalent of UPSERT

UPSERT means INSERT and\or UPDATE, is there a standard name for a sproc that will INSERT if necessary and then SELECT? e.g. I want to get the IS of a row that matches fields and give me the ID, if ...
0
votes
0answers
31 views

Naming convention for columns with same name (but different logically)?

How do I name columns in my database tables which have the same name in outside world but are logically separated? Lets say an example Company Share: 100% of 50% Now I have two company shares: ...
0
votes
1answer
36 views

What is the correct name for “relational role”?

If I want to describe a column as one of the following: Surrogate key Natural key Foreign key Attribute etc. then what do I call this list? Relational roles? I don't think "column type" quite cuts ...
0
votes
2answers
49 views

Multiple relationships between the same entities

Is there a name for when 2 entities can have multiple relationships between them?