Test #2 Review Flashcards
Entity Type / set
denoted as a rectangle
Relationship
Diamond that connects two entity types
Attribute
describes a fact about an entity of interest
ex. professors birth date
Composite attribute
a value that has multiple parts, such as professors name which may have first, middle, last, etc.
Derived attribute
a value that may be derived from some others attribute in the entity.
ex. age which can be derived from birthdate
Multi-valued attribute
An attribute named contact numbers may contain several phone numbers at which a professor may be accessed
Generally speaking, each ______ will become a table in the database, with its ______ as columns
entity type, attributes
For relationship types, we need to know about their ____________
cardinality constraints
Cardinality constraints
specify how many instances of related entity types can be associated with each other.
Name the ways in which two entities can be associated:
one to one
one to many/many to one
many to many
Key
unique identifier that can be used to distinguish instances in an empty set
True/False | There may be multiple keys due to the nature of business data
TRUE
Candidate key
all possible candidate attributes for the primary key
Surrogate key
An artificially generated identifier, typically an auto-incrementing integer, used to uniquely identify a record.
Natural key
unique identifier derived from the data itself
How is a composite attribute represented
Normal circle
How is a Derived attribute represented
dashed circle
How is a multi-valued attribute represented
double circle
Types of constraints:
PRIMARY KEY, UNIQUE, FOREIGN KEY, NOT NULL
How to create a table in SQL
CREATE TABLE TableName (
data datatype PRIMARY KEY
data datatype UNIQUE NOT NULL
);
Foreign key
references a key in another table
how to specify foreign key
FOREIGN KEY REFERENCES tableName (keyName)
Data Manipulation Language
INSERT
UPDATE
DELETE
How to insert into table in SQL
INSERT INTO TableName
VALUES ( ‘title’ , number );