On 18-12-2014 15:59, brucedickin...@wp.pl [firebird-support] wrote:
> Hi guys,
>
> in our database I see two naming conventions for foreign key columns:
>
> 1.
> <SOMETHING>_ID
>
> 2.
> ID_<SOMETHING>
>
> which one do you use and why?
>
> I see that in system tables the first convention is used (f.e.
> MON$TRANSACTION_ID, MON$ATTACHMENT_ID)
>
> Thanks for your opinion.

I usually use <table>_ID for primary *and* foreign key. Using the same 
name in the source and target table (when possible and logical) also 
allows you to use the USING clause in a join, and keeps columns readable 
even if you alias the table to something short.

However naming conventions are a matter of opinion. In general within a 
team or company decide on one naming convention and stick to it (within 
reason).

Mark
-- 
Mark Rotteveel
  • [firebird-support] ... brucedickin...@wp.pl [firebird-support]
    • Re: [firebird-... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]

Reply via email to