Is 21 -_databases

8
Entity -> Entity Set -> Attributes

description

Databases

Transcript of Is 21 -_databases

Page 1: Is 21 -_databases

Entity -> Entity Set -> Attributes

Page 2: Is 21 -_databases

ENTITY – may be a person, place, thing, event or event concept

ENTITY SET – is a named collection of related data. The data within an ENTITY SET are related through their classification.

Example: The data in an EMPLOYEE Entity Set are related by the fact that only employee data are stored in this set. In other words, EMPLOYEE entities only, don’t expect that you can find product entities.

Each entity has characteristics know as ATTRIBUTES (field names)

Example: An EMPLOYEE entity have an ATTRIBUTES such as EMP_ID, EMP_LNAME, EMP_FNAME etc.

EMPLOYEEEMP_idEMP_LnameEMP_FnameEMP_Mname

Page 3: Is 21 -_databases

ENTITIES are stored in a DATABASE TABLE.

is a matrix composed of intersecting ROWS and COLUMNS.

Each row known as TUPLE, is uniquely identified by an attribute known as PK (Primary KEY).

Example: A Student ID might uniquely identify a student.

Each column is named for an attribute and contains the ATTRIBUTE VALUES for the attribute it represents.

Example:Field NAME TYPESTUD_ID NumericSTUD_Lname Character

Page 4: Is 21 -_databases

What is Primary Key (PK)

PK may be a single attribute or may be composed of a combination.(Unique Identifier)

PK that consists of a combination of attributes is known as COMPOSITE PRIMARY KEY.

INV_NUM LINE_NUM PROD_CODE

00143 1 001

00143 2 001

00143 3 001

A number of INV_NUM may occur many times and LINE_NUM occur once.

If any attribute or combination of attributes that could serve the role as PK is not selected to the PK , that attribute or combination of attribute is know as CANDIDATE KEY.

A PROD_CODE can be a PK

Page 5: Is 21 -_databases

SECONDARY KEY – is used as NON-PK search key.

Example: You don’t know the ID Number of the Student, You can search by their Lastname or any set of attributes.

FOREIGN KEY – the relationship between TABLES is establish through the use of Foreign Key

This will matches the PK in the table.

STORE

PK STORE_CODE

FK REGION_CODE

REGION

PK REGION_CODE

REGION_NAME

Page 6: Is 21 -_databases

ATTRIBUTE CHARACTERISTICS selecting and naming attributes is an important aspect of the database design process, especially when the design is to be implemented. To make easier to draw the

information from the database be SIMPLE and SINGLED VALUED.A SIMPLE OR ATOMIC ATTRIBUTE is

one that cannot be further divisible into its components.

Example: Gender Attribute is a Simple Attribute because it cannot be subdivide into meaningful components

COMPOSITE ATTRIBUTE an attribute that can further subdivide into its components.

Example: An Employee Attribute can be subdivide into Lastname, Firstname etc.

SINGLE-VALUED ATTRIBUTE – can have only one value.Example: you have only one Firstname, only one birth date and only one ID

MULTIVALUED – can have many value.Example: EMP_DEGREE can have many value, CS, IT, IS

Page 7: Is 21 -_databases

TERMS: Entity, Entity Set,Attributes, Database table, Rows, Columns, Primary Key, Composite Key, Candidate Key, Secondary KeyForeign Key, Attribute Characteristics, Simple Attribute, Composite Attribute, Singled-Valued Attribute, Multivalued Attribute.

Quiz on Wednesday…

Assignment…Bring any bills or receipt Wate bill, electric bill, statement of account and others.

Page 8: Is 21 -_databases

Stud_Num Stud_Name Stud_Major Stud_dob Stud_hours Stud_Status Stud_GPA Stud_Age

21223 Hillard, Jona BSCS 03/12/72 102 Senior 3.20 26

21226 Smith, Jhon BSIS 09/20/80 79 Junior 2.98 18

Attribute Simple Single Valued Composite Multivalued

Stud_Num X X

Stud_Name

Stud_Major

Stud_dob

Stud_hours

Stud_Status

Stud_GPA

Stud_Age

Identify the attribute type for each database table, the first line is already completed.Stud_Num can be simple and singled valued.