Internet & Web development (2)/Course materials/Web Site Issues/Integrity

From WikiEducator
Jump to: navigation, search



Integrity

According to the Merriam-Webster (Intregity, 2014)[1]there are two branches of integrity and both meanings are used in Web development

  • For humans (developer, client, user)
    • the quality of being honest and fair
  • For data/databases
    • the state of being complete or whole

Human integrity

  • For Developers and IT Professionals this is often governed by a voluntary professional code of conduct
  • For Clients and Users this can have many interpretations and may be affected by cultural factors. Things that fall into this category include:
    • Downloading movies, sounds and images
    • Copying look and feel, web sites, multimedia etc.

Database integrity

Most online systems have at their core a database, and the database is valuable only if the data in it is correct. Taylor (2006, pp. 104-)[2] identifies three kinds of database integrity.

  • Entity integrity
  • Domain integrity
  • Referential integrity

Entity integrity

An entity corresponds to something in the real world. As such you must be able to connect the entry in the database with the correct one in the real world. This is commonly achieved by specifying a primary key in the table that allows each record to be unique. In the Person table an entity integrity error could occur if we try to add a person with an ID (PerID) which is already in the table.

INSERT INTO tblPerson  VALUES (1,'G Raff','F', 'AA999887');

Domain integrity

Many data items can only take specific values, for example, gender in tblPerson can only be Male (M) or Female (F). MySQL provides the ENUM data type.

So if you tried to add or update a Persons record containing "X" for gender this would fail domain integrity

INSERT INTO tblPerson  VALUES (\N,'Ba Boon','X', 'AA767676');
UPDATE tblPerson SET PerGender = 'X' WHERE PerID = 2;

Referential integrity

An example of Referential integrity is when an Item is added to the database it MUST belong to a Person. So before a Item can be entered the Person MUST be created. Referential Integrity will fail if the Item is added before the Person is created.

INSERT INTO tblItem VALUES
  (\N,999,'Gazontite DVD Player GZ123','GZ11335577',987);

Here the PerID 999 must be created first in the Person table

VmvIcon References.png References

  1. Intregity (2014). In Merriam-Webster. Retrieved from http://www.merriam-webster.com/dictionary/integrity
  2. Taylor, A.G. (2006) SQL for Dummies, 6th Ed. Wiley. Retrieved July 19, 2009 from http://books.google.co.nz/books?id=aB3DhgoB9UIC&pg=PA104&lpg=PA104&dq=mysql+entity+integrity&source=bl&ots=giMUL2IkcI&sig=T9eqa_-JVfdbWGo0lNqBEJ7MCOg&hl=en&ei=UABjSuuwK4LAsgO44Mhm&sa=X&oi=book_result&ct=result&resnum=2

virtualMV  |  Superquick wiki guide  |  Please give me some feedback

Internet & Web development (2)/Course materials/Web Site Issues/Integrity. (2017). In WikiEducator/VirtualMV wiki. Retrieved November 18, 2017, from http://wikieducator.org/Internet_%26_Web_development_(2)/Course_materials/Web_Site_Issues/Integrity    (zotero)