Infoman Finals
Infoman Finals
Infoman Finals
Relational model enables you to view data logically rather than physically.
Logical view of the relational database is facilitated by the creation of data relationships based
on a logical construct known as a relation.
Logical relation – a relation whose contents can be permanently saved for future use.
2.KEYS
– used to ensure that each row in a table is uniquely identifiable.
– used to establish relationships among tables and to ensure the integrity of the data.
– consists of one or more attributes that determine other attributes.
DEPENDENCIES
Determination is the state in which knowing the value of one attribute makes it possible
to determine the value of another.
Functional Dependence – the value of one or more attributes determines the value of
one or more other attributes.
Superkey – is a key combination of attributes that can uniquely identify any row in the table. In
other words, a superkey functionally determines every attribute in the row.
Entity integrity – is the condition in which each row (entity instance) in the table has its own
unique identity.
To ensure entity integrity, the primary key has two requirements:(1) all of the values in
the primary key must be unique, and(2) no key attribute in the primary key can contain a
null.
Null is the absence of any data value, and it is never allowed in any part of the primary key and
it could represent any of the following:
● An unknown attribute value
● A known, but missing, attribute value
● A “not applicable” condition
Foreign Key (FK) – is the primary key of one table that has been placed into another table to
create a common attribute.
– Foreign keys are used to ensure referential integrity
– Referential integrity – the condition in which every reference to an entity instance by
another entity instance is valid.
– Foreign key entry must either be null or a valid value in the primary key of the related
table.
Secondary Key – is defined as a key that is used strictly for data retrieval purposes.
3.INTEGRITY RULES
To avoid nulls, some designers use special codes, known as flags, to indicate the absence of
some value.
Relational Algebra – defines the theoretical way of manipulating table contents using
relational operators.
SELECT – is referred to as a unary operator because it only uses one table as input.
– It yields values for all rows found in the table that satisfy a given condition.
PROJECT – yields all values for selected attributes. It is also a unary operator, accepting only
one table as input.
– will return only the attributes requested, in the order in which they are requested.
– yields a vertical subset of a table.
UNION – combines all rows from two tables, excluding duplicate rows.
– the tables must have the same attribute characteristics; in other words, the columns
and domains must be compatible.
– When two or more tables share the same number of columns, and when their
corresponding columns share the same or compatible domains, they are said to be
union-compatible.
INTERSECT – yields only the rows that appear in both tables. As with UNION, the tables must
be union-compatible to yield valid results. For example, you cannot use INTERSECT if one of
the attributes is numeric and one is character-based. For the rows to be considered the same in
both tables and appear in the result of the INTERSECT, the entire rows must be exact
duplicates.
DIFFERENCE – yields all rows in one table that are not found in the other table; that is, it
subtracts one table from the other. As with UNION, the tables must be union-compatible to yield
valid results.
PRODUCT – yields all possible pairs of rows from two tables—also known as the Cartesian
product.
A left outer join yields all of the rows in the CUSTOMER table, including those that do not have
a matching value in the AGENT table.
A right outer join yields all of the rows in the AGENT table, including those that do not have
matching values in the CUSTOMER table.
Relationship
1:M Relationships
1:1 Relationships
M:N Relationships
DATA DICTIONARY – provides a detailed description of all tables in the database created by
the user and designer.
– contains at least all of the attribute names and characteristics for each table in the
system.
– data dictionary contains metadata—data about data.
Simple attributes
Composite attributes
Single valued attributes
Multi valued attributes
Derived attributes
Key attributes
Simple attributes are those attributes which can not be divided further. (Id/No, Class, Age)
Composite attributes are those attributes which are composed of many other simple attributes.
(Address: Street, City, Country, State.. Name: Fname, Mname, Lname)
Single valued attributes are those attributes which can take only one value for a given entity
from an entity set. (Id/No, Age, Gender, DOB)
Multi valued attributes are those attributes which can take more than one value for a given
entity from an entity set
SELECT FirstName AS "First Name", mName AS "Middle Name" from tbl _person;