Everything depends on the taste of the team and whether there is already a standard in the company.
As there is no 100% standard I will give the tips of the rules I follow, after a few years fiddling with databases, and mainly by the fact that you say you want to program for Atms.
Come on, first a detail, Oracle doesn’t have Lower Case
, that’s all Upper Case
. So leaving this way I use the rules for all banks:
- Tables - All in Upper Case
- Uso Camelcase
- Do not use composite PK
- Table names all in Portuguese or English, no mixing
- Standard for PK, FK, CK, UK and related use:
- Name of the table_XXyy, where XX is the type and yy is a sequential number. So it is much easier to find the problem, and also if you search in the database constraints they come in order and organized
- Always use single PK, even in tables N x N. This allows to greatly simplify the FK and also the use of ORM. In addition the
joins
are much easier
- In query, I always use the commands select, from and the like in Lower case, tables in Upper Case and fields in Camelcase, getting very visual and easy to understand the querys
With these rules you can do select
in this way:
select
UsuarioID, Nome, Login
from
USUARIO
order by
Login
Example with Join
select
a.UsuarioID, a.Nome, a.Login, a.EmpresaID
from
USUARIO a
inner join EMPRESA b on b.EmpresaID = a.EmpresaID
order by
a.Login
I hope I’ve helped.
I believe those names are not case sensitive, so, whatever.
– user7261