Professor Materials Week 3 Flashcards
What are the elements of ER Models?
Entity
Attribute
Relationship
What is an entity class?
Something the user wants to track.
Typically nouns.
Represented by a rectangle with a singular name
What is an entity instance?
The actual occurrence of the data
Usually never shown
What is an attribute?
data item that is used to describe an entity.
show by ovals and connected to the entity rectangle with a line
Simple vs Composite attributes
Simple – composed of one piece of data
composite – an attribute composed of other attributes (like an address)
Not shown in crow’s foot notation
Single vs mutli-valued attr
Single – one single piece of value
Multi (double circle) – an attribute that stores multiple data values (skills = carpentry, plumbing, painting)
Store vs derived attr
Stored – actually stored
Derived – the data value is calculated (dotted circle) age (calc by DOB)
What is identifier?
Most entities will have one
One or more attributes that identify an entity instance
If two or more, composite identifier
Can be unique or non-unique
Denoted by underline in Chen Notation
What are the steps to transposing data mdoel into relations?
Transposing:
1. Name of hte entity becmes the name of the relation
2. Attributes become the attributes of the relation
3. The identifier of the entity becomes the proposed primary key of the relation, denoted by underlining
What is Relational Schema notation?
RELATION(attr(underlined), attr2, att3)
A(2,3(both 2 and 3 underlined), 4,5)
What is 1NF?
First normal form.
* Rows contain data about tuples or instances of the relation
* Cells of the relation hold a single value (no arrays)
* Columns are attributes of the relation
* All entries in a column are of the same domain (physical and logical)
* EAch column has a unique name
* The order of the attr is unimportant
* The orer of the tuples is unimportant
* No two tuples may be identical (must have primary key can be either) – natural primary key vs surrogate primary key (used only to guarantee uniqueness)
* No repeating groups – more than one attr from the same physical and logical domain (ex author1, author1email, author2, author2email)
How do you create a relational schema with DMBS?
Using SQL.
Data Definition Language DDL
Primarily metadata, CREATE DROP
Data Manipulation Language DML
User data, INSERT, SELECT
Transaction Control Language TCL
Commit, rollback. Data Control Language