sql databse relationships architecture?

Arslan Abbasi 21 Reputation points
2022-08-18T12:22:59.93+00:00

Hi im arslan ,
i have seen first time ever sql database tables working without foreign key relation in big project .
what is the best practise to use relational database ,1 with foreign keys . 2 without foreign keys?

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. YufeiShao-msft 7,146 Reputation points
    2022-08-19T07:46:03.667+00:00

    Hi @Arslan Abbasi ,

    Foreign key.
    Foreign key constraints are as essential to a relational database as are tables and columns
    The obvious problem with the lack of foreign keys is that a database can not enforce referential integrity, and tables relations are not clear

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-08-18T21:58:35.68+00:00

    With foreign keys!

    There are people who say "oh, we manage this in the application". Which often results in orphan rows and other sorts of inconsistencies.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.