You are on page 1of 21

Data at the Core

of the Enterprise
DATA

?
INFORMATION
Data hierarchy

 Bits
 Characters
 Fields (columns)
 Records (rows)
 Files (table)
 Database
Attributes of data
 Sharable
 Moveable
 Secure
 Accurate
 Timely
 Relevant
Relational model
 Relation? Attribute? Tuple?
 Keys
 Super Key
 Candidate Key
 Primary Key
 Foreign Key
 Alternate Key
Relational DB rules
 Every row must have exactly the same
number of columns (fields or attributes)
 Each row can have only one value stored in
each column (fields or attributes)
 A column must contain the same kind of
value in every row of that column
 No two rows can be exactly the same
 The order of the rows or of the columns can’t
be used to provide information
Terminology
Data Informal Formal
Processing Relational DB Relational DB

File Table Relation

Record Row Tuple

Field Column Attribute


Attribute
•In general, an attribute is a property or characteristic. Color, for
example, is an attribute of your hair.
•In using or programming computers, an attribute is a changeable
property or characteristic of some component of a program that can
be set to different values.
•In the Hypertext Markup Language (HTML), an attribute is a
characteristic of a page element, such as a font. An HTML user can
set font attributes, such as size and color, to different values.
•In some programming languages, such as PowerBuilder
PowerScript, an attribute is a property of an object or may be
considered a container for the property of the object. For example,
color might be an attribute of a text object, containing the value of
"red.“
•In a database management system (DBMS), an attribute may
describe a component of the database, such as a table or a field, or
may be used itself as another term for a field.
Single and Composite Attributes

Attributes can be classified as having many parts to them or just a


single unbreakable attribute. The composite attribute is an attribute
that can be subdivided into other single attributes with meanings of
their own. A single attribute is just an attribute that cannot be
subdivided into parts.
Example: Imagine from the entity Student that instead of having
the three attributes: stu_LastName, stu_MiddleName,
stu_FirstName it had one attribute called stu_Name. The attribute
stu_Name would be considered a composite attribute since it can
be subdivided into the other three attributes: stu_LastName,
stu_MiddleName, stu_FirstName. The rest of attributes would be
consider single attributes since they can't be subdivided into parts
Single-valued and multi-valued Attributes

Attributes can be classified as single or multi value. The single-value


attribute can only have one value, while the multi-valued attributes
usually can store multiple data in them.
Example: In the entity Student, stu_Address could be considered
a multi-value attribute since a student could have multiple
addresses where he lives at. An example of a single-value attribute
would be stu_LastName since a student usually has one last name
that uniquely identifies him/her.

Mandatory and Null Attributes


Key
Key  One or more columns in a database table that is used to
sort and/or identify rows in a table. e.g. if you were sorting people by
the field salary then the salary field is the key.
Super Key  A combination of one or more columns in a table
which can be used to identify a record in a table uniquely, a table
can have any number of super keys.
Candidate Key  A Column (or) Combination of columns which
can help uniquely identify a record in a table without the need of any
external data is called a Candidate Key. Depending on the need and
situation a Table may have one or more candidate keys and one of
them can be used as a Primary Key of the table.
A candidate key is a sub set of a Super Keys  For Example, In
an Employee Table, we may have columns like Employee ID,
Employee Name, and Employee SSN. We can consider either
Employee ID or Employee SSN as Candidate Key’s
Key (cont)
Compound Key  A Combination of more than one column
identifying records of a table uniquely, all the columns that take part
in the combination process are Simple Key’s.
We can represent this buy taking a table which has the combined
information of Department to Employees, Employee ID +
Department ID – here both of them define a record in this table, but
both can make sense separately as well.
Primary Key  A Column in a table (which is a Simple Key) which
is a Candidate Key (Uniquely identify a records in a table) and has
the Constraint NOT NULL attached to it is known as a Primary Key.
Generally, but not always and need not be, Primary Key goes with a
Clustered Index.
Key (cont)
Composite Primary Key (Composite Key)  When we have a
Primary Key of a table defined using more than one columns then it
is known as a Composite Key, each columns data can be
duplicated, but combined values cannot be. The columns which are
participating in a composite primary key are not simple keys.
For Example, we can have a situation where there is a need to
define the key using first Name + last Name.
Alternate Key  We cannot define the Alternate Key Seperately
from a Candidate Key, for a table, if there are two Candidate Key’s
and one is chosen as a Primary Key the other Candidate Key is
known as the Alternate Key of that table.
In Example, we can consider the Employee SSN as Alternate Key
as we have taken Employee ID as our Primary Key
Key (cont)
Unique Key  A column (or) combination of columns which can be
used to uniquely identify a record in a table, it can have one NULL
Value.
Primary Key can be considered a special case of unique key with a
Not Null Constraint.
Generally, but not always and need not be, Unique Key goes with a
Non Clustered Index.
Foreign Key  A column of one table points to the Primary Key
column of another table to implement referential data integrity.
For Example, we can have a department id column in the employee
table which is pointing to department id column in a department
table where it a primary key.
Example of Key
Entity relationship modeling
 List the entities or objects in the
environment
 People, things, transactions
 Describe the relationship between them
 A single row in table A can be related to
how many rows in table B (one or many)
 A single row in table B can be related to
how many rows in table A (one or many)
ERD questions
 What are the subjects/objects of the
business?
data entities
 What unique characteristic(s) distinguishes
each object from others of same type?
primary key
 What characteristics describe each object?
attributes
 How do you use this data?
controls & meaning
ERD questions
 Over what period of time are you interested in
this data? cardinality & time dimensions

 Are all instances of each object the same?


supertypes, subtypes, aggregations
 What events occur that imply associations
between objects? relationships (cardinality & degree)

 Is each activity or event always handled the


same way or are there special
circumstances?
integrity rules, cardinality, time
SQL
 Definition (DDL)
 CREATE, ALTER, DROP
 Manipulation (DML)
 SELECT, INSERT, UPDATE, DELETE
 What’s the most used sql command?
General format of SELECT
SELECT [DISTINCT] item(s)
FROM table(s)
[WHERE condition]
[GROUP BY columns]
[HAVING condition]
[ORDER BY row(s)]
Emerging data requirements
Complex
Graphics
Video
HTML/ Audio
Video Streams SGML
Spatial Data
Time Series

Unstructured Structured
Images Text
Audio Streams

Current RDBMS

Simple

You might also like