Big question!
It's largely a matter of style, provided you don't use reserved words or
others that are known to be ambiguous. Unfortunately, that's a large list.
There's over 1200 listed here:
http://allenbrowne.com/AppIssueBadWord.html
or you can get Access to check your database with this utility:
http://allenbrowne.com/AppIssueChecker.html
There are suggested naming conventions such as:
http://www.xoc.net/standards/rvbanc.asp#DAO
Answers for your specific questions in-line below.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Lina Manjarres said:
I wish some one can suggest me the best way to name tables and columns.
For example:
Should I use underlines?
Underscores are fine.
I don't use them personally, as it's just one more unnecessary character.
Instead, I use mixed case such as CompanyName or OrderID.
Access remembers the case, but is not case-sensitive.
Should I use the table name inside the column name? and if so, should I
have the table name before the column name?
Some developers use the table name as part of the field name, and it works.
Again, I don't because it makes lots of extra typing.
Where I need to distinguish the same names from different tables, I can:
- use the TableName.FieldName syntax, or
- alias the field.
Leaving the names the same has some advantages. For example, if you have an
OrderID primary key in tblOrder, and an OrderID foreign key in
tblOrderDetail, Access guess the LinkMasterFields/LinkChildFields correctly
when you create a subform.
To have the Autonumeric Id of each table named just Id, could be
confusing?
You could get away with it, but I think it makes sense for the primary key
to include the table name.
Again, it makes the joins more obvious: tblOrder.OrderID probably matches
tblOrderDetail.OrderID.