|
Posted by Jegg on 05/03/07 12:39
I was taught in school that entity names (tables) should always be in
the singular. So the table name would Order, instead of Orders (each
row being one order, presumably). I think either
CREATE TABLE dbo.Order
(
OrderID int NOT NULL,
CustomerID int NOT NULL,
OrderDate smalldatetime
)
CREATE TABLE dbo.order
(
order_id int NOT NULL,
customer_id int NOT NULL,
order_date smalldatetime
)
I generally go with either mixed case and no underscores, or all
lowercase with underscores. (I work with many outside systems, so I
try to keep consistency with their structure.) But as the others
said, which ever you pick absolutely be consistent. I would also use
consistent abbreviations (e.g. id for identifier, descr for
description, no for number, etcetera). The goal is to not have to
think about what the column is named in each table, but to know
instinctively.
Object prefixes like tbl are okay. Sometimes it's nice to have
something like t_order and v_order where you can create a similar view
that maybe brings in more information from other tables. I would
suggest using them if you have trouble keeping up with that is where.
I also like to name objects in a way that orders them logically. For
example, if you have a table for orders, canceled orders and back
orders, I would name them order, order_back, order_canceled or
something like that (instead of order, back_order, canceled_order).
This will keep all your order tables together in a list.
Navigation:
[Reply to this message]
|