faqts : Computers : Programming : Languages : Sql

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 10 people (70%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Database: Relational: Integrity: Referential: What is: What is referential integrity?

Mar 13th, 2005 10:26
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 13 March 2005 - 10:45 pm ----------------------

Database: Relational: Integrity: Referential: What is: What is 
referential integrity?

---

'Referential' means here 'referring to', 'Integrity' means here 'is 
fulfilled',
thus it indicates that the relation you are referring to is fulfilled:

Referential integrity means that when a record in a table refers to a
corresponding record row in another table, that corresponding record
row must exist.

---
---

e.g.


table1:

-----------------------------------------------------------------
| NUMBER                           | NAME                       |
-----------------------------------------------------------------
  1                                  John
  2                                  Vanessa
-----------------------------------------------------------------


table2:

----------------------------------
| STUDY               | NUMBER   |
----------------------------------
  Physics               1
  Mathematics           2
  Computer science      3
----------------------------------


In table2, the number '3' in the column 'NUMBER' refers to a non 
existing
row 3 entry in the column 'NUMBER' in table1.

It says thus that
John studies Physics,
Vanessa studies Mathematics,
? studies Computer Science.

Thus there is here no referential integrity between this tables.

---
---

Internet: see also:

---

[Internet: source: http://www.google.com search for 'how to implement 
innodb table MySql foreign key': 
http://databasejournal.com/features/mysql/article.php/2248101]

---

Database: Language: SQL: Overview: Can you give an overview of links 
about SQL?
http://www.faqts.com/knowledge_base/view.phtml/aid/32811/fid/54

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