Week 1.5 Flashcards
Reasons for using ISA (sub classes)
1) To add descriptive attributes to the subclass
2) To Identify entities that participate in a relationship
ER Is used for what
Conceptual database design
3 Basic constructs of ER
1) entities
2) relationships
3) attributes (of entities and relationhsips)
Overlap Constraints:
determine whether the entities in the subclass collectively include all entities in the superclass
What is a characteristic of covering constraints?
1) Determine whether the entities in the subclass collectively include all superclass entities
2) Determine whether the subclasses have different entities in the class
3) Determine whether the subclasses have permission to contain the same class
1) Determine whether the entities in the subclass collectively include all superclass entities
Correct
In the example, all the contract/hourly employees belong to the master employees entity which explains covering constraints.
Overlapping Constraints
determine whether two subclasses are allowed to contain the same class entity
Aggregation
Allows relationships with relationship sets
Duration
ternary relationship
ternary relationship
A ternary relationship is when three entities participate in the relationship.
A university database records professors that taught subjects in courses. Based on the entities participating in the relationship, what kind of relationship is this?
1) Ternary relationship
2) Binary relationship
Ternary relationship
What does ISA mean
It is a member of a higher class
In a Database the Number of Rows are called
cardinality = count(*)
In a Database the Number of Fields are called
degree (id,fname,etc)
If you would like to insert a new company tuple in your corporation’s table, what is the most likely correct command?
1) INSERT INTO COMPANY ( NAME, CITY, STATE)
(“ASU CORP”, “TEMPE”, “AZ”)
2) INSERT INTO COMPANY
VALUES( 3, “ASU CORP”, “TEMPE”, “AZ”)
3) INSERT INTO COMPANY (NAME, CITY, STATE)
VALUES (“ASU CORP”, “TEMPE”, “AZ”)
INSERT INTO COMPANY (NAME, CITY, STATE)
VALUES (“ASU CORP”, “TEMPE”, “AZ”)
Integrity Constraints
Integrity constraints ensure that the data insertion, updating, and other processes have to be performed in such a way that data integrity is not affected.
Primary Key Constraints
niquely identifies each record in a table. Primary keys must contain UNIQUE values, and cannot contain NULL values.
Super Key
A superkey is a combination of columns that uniquely identifies any row within a relational database management system (RDBMS) table.
Foreign key database
A foreign key is a column or group of columns in a relational database table that provides a link between data in two tables. … The concept of referential integrity is derived from foreign key theory. Foreign keys and their implementation are more complex than primary keys.
What is a tuple?
A tuple is a set of sets, defining a container with order. In SQL, it is used to represent a row. SQL uses sets of tuples to do it’s magic - model and retrieve data. Simply put, a tuple is a row in a table. A field or attribute of a table is a column.
Why is referential integrity important?
1) It ensures a tight relationship between foreign keys in a table.
2) It ensures the correctness of data within a DBMS.
3) It ensures multiple primary keys to exist in a tuple.
2) It ensures the correctness of data within a DBMS.
Ways to deal with a delete in a foreign key (data) when the primary key (data) is deleted from the database
1) Do Nothing
2) cascade delete
3) reject
4) Set Null
When creating a join table use what primary key
From both tables to create a multiple columns primary key (they are also foreign keys)
In the following SQL, what is/are the key constraints? CREATE TABLE Employees ( employee_id INTEGER, badge_id INTEGER, PRIMARY KEY (employee_id), FOREIGN KEY (badge_id) REFERENCES Badge ); 1) PRIMARY KEY and FOREIGN KEY 2) FOREIGN KEY 3) PRIMARY KEY
1) PRIMARY KEY and FOREIGN KEY
sql participation constraint definition
t specifies that each entity in the entity set must compulsorily participate in at least one relationship instance in that relationship set. That is why, it is also called as mandatory participation.
sql participation constraint code
NOT NULL,
Weak Entity set should have
1) keys?
2) Delete super?
1) foreign key (part of primary key)
1) On Delete Cascade (delete if primary key deleted)