locked
Table relationship Purpose RRS feed

  • Question

  • Hi

    What is the purpose of tables relationship?

    Best...

    Mehran


    Mehran

    Monday, April 14, 2014 11:26 AM

Answers

  • Becouse that is the backbone for Relational Database Management System like SQL Server.

    Without relation you can't join two tables and remain as a standalone tables.


    Regards, RSingh

    Monday, April 14, 2014 11:46 AM
    Answerer
  • Following RSingh's comments.

    Relationships between two tables underpins relational theory and all relational databases are based on this theory.

    Please see the link.

    If you are serious about understanding the subject or relational theory the two main authorities are Codd and C J Date. Their books are quite academic and difficult to read as an introduction. However the book; - Training Kit (Exam 70-461): Querying Microsoft SQL Server 2012 (Microsoft Press Training Kit) [Paperback] does provide a good introduction to relational theory in the early chapters.

    To give you a more practical example answer to your question. You could have a order table containing a customer ID which allows you to relate a particular customer which has raised particular orders.


    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    • Proposed as answer by Sofiya Li Tuesday, April 15, 2014 9:23 AM
    • Marked as answer by Mehran52 Tuesday, April 15, 2014 11:30 AM
    Monday, April 14, 2014 11:56 AM

All replies

  • Becouse that is the backbone for Relational Database Management System like SQL Server.

    Without relation you can't join two tables and remain as a standalone tables.


    Regards, RSingh

    Monday, April 14, 2014 11:46 AM
    Answerer
  • Following RSingh's comments.

    Relationships between two tables underpins relational theory and all relational databases are based on this theory.

    Please see the link.

    If you are serious about understanding the subject or relational theory the two main authorities are Codd and C J Date. Their books are quite academic and difficult to read as an introduction. However the book; - Training Kit (Exam 70-461): Querying Microsoft SQL Server 2012 (Microsoft Press Training Kit) [Paperback] does provide a good introduction to relational theory in the early chapters.

    To give you a more practical example answer to your question. You could have a order table containing a customer ID which allows you to relate a particular customer which has raised particular orders.


    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    • Proposed as answer by Sofiya Li Tuesday, April 15, 2014 9:23 AM
    • Marked as answer by Mehran52 Tuesday, April 15, 2014 11:30 AM
    Monday, April 14, 2014 11:56 AM
  • 1. Get the integrated DataBase : for example not have the invoices without customers, and not have the articles without the family article.

    2. To use the index in the destination tables, so to accelerate the search in your SQL Query, for example if you need the sales by city (the invoice table contains a foreign key of city).

    3. To use a cascade update for example your a customer named (Cocacola), and this customer have 10000 invoice, and you need to change the name of this customer (Cocacolla) instead (Cocacola), without update cascade you need to update the name in the both tables (Customer and invoice) in on transaction.

    4. The same for a cascade delete.

    5. ensure that your data is sure, for example to not have the invoice with a customer doesnt exist in customer table.

    • Proposed as answer by Sofiya Li Tuesday, April 15, 2014 9:23 AM
    Monday, April 14, 2014 12:02 PM
    • Proposed as answer by Sofiya Li Tuesday, April 15, 2014 9:23 AM
    Monday, April 14, 2014 2:11 PM