March 21st, 2010

Data Integrity

Posted by admin in B. SQL Basics

Data integrity is the consistency of data. The row(s) that are used for the primary key must have a value. This is called “Entity Integrity.” The row(s) that maintain relationship consistency between tables (foreign keys) are for “Referential Integrity.” Referential integrity requires that every foreign key value in one table must have a matching primary key value in the corresponding table or have a null (not used) value.For example, you may not allow a person to be added to the payroll table until that person has been entered into the employee table first.

March 20th, 2010

Union

Posted by admin in B. SQL Basics

A table “union” means that the rows of one table are combined under the rows of another table. Unions are rarely used.

Table A:

Table B:

Result table of a union:

The definition (data type) and number of columns in the first table must exactly match the definition and number of columns in the second table. Since the source tables may have different column names, the result table has no column names.

March 19th, 2010

Join

Posted by admin in B. SQL Basics

A table “join” means that data from two or more tables can be used to create a single result table. The join makes an RDBMS a very powerful tool.

EMPLOYEE_TBL:

 

PAYROLL_TBL:

Joined Result Table:

« Previous PageNext Page »