Week 8 - Enhanced ERM and OO-RDBMS Flashcards

1
Q

Applications of E-ERM

A

Engineering databases (CAD, CAM)
Multimedia apps
Data mining and warehousing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to indicate that MANAGER is a subclass of EMPLOYEE

A

EMPLOYEE ⊃ MANAGER

(class ⊃ subclass)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Subclass Entities

A

They inherit attributes/relationships of superclass entity.

They have their own specific, local attributes and relations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Advantages of type inheritance (using subclass entities)

A

Avoid describing similar concepts more than once
Add more semantic information to the design

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Specialization

A

A top-down process. The process of breaking a superclass into a set of subclasses.
1) Start with a superclass (e.g. employee)
2) Identify attributes of the subclasses
3) Establish relationships specific to subclasses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Generalization

A

The opposite of specialization in that it is a bottom-up process, where you group specific entities into a broader subclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Constraints in specialization

A

Rules about how entities are divided

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Constraint: Disjoint Total

A

An entity can belong to exactly one subclass
(e.g. a CAR cannot be both a TRUCK and a BIKE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Constraint: DIsjoint Partial

A

An entity can belong to exactly one subclass or none.
(e.g. A generic VEHICLE might not be a TRUCK or a CAR)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Constraint: Overlapping Total

A

An entity must belong to at least one subclass, possibly multiple.
(STAFF could also be STUDENT)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Constraint: Overlapping Partial

A

An entity can belong to multiple subclasses or none.
(PARTS could be MANUFACTURED or PURCHASED or neither).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Multiple inheritance

A

A subclass with more than one superclass.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Union Type, Partial Category, Total Category

A

idk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Single Relation VS Multiple Relation

A

Multiple:
- Employee(SSN, Name, Address)
- Secretary(SSN , TypingSpeed)
- Technician(SSN, EngType)

Single (disjoint subclasses, use null values, not recommended when lots of specific attributes are defined):
- Employee(SSN, Name, Address, TypingSpeed, EngType)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What additional attributes will your relation need in the event of overlapping subclasses?

A

Boolean fields to represent which subclasses it belongs to, since with overlapping subclasses an entity can belong to more than one subclass at a time.

PART ⊃ MANU_PART, PART ⊃ PURC_PART
so your relation would have additional columns: M_flag, P_flag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What would your relations look like in the event of a shared subclass?

A

teaching_assistant is a specialization of employee and specialization of student. they all share SSN.
EMPLOYEE(SSN, Salary, Position, Rank)
STUDENT(SSN, MajorDept, DegreeProgramme)
TEACHING_ASSISTANT(SSN)

alternatively, you could use boolean flags in employee and student (isTeachingAssistant)

17
Q

Imagine creating a new object type, then creating a table that contains a column of data type ‘person’. What happens when you try to DROP the ‘person’ data type?

CREATE TYPE person AS OBJECT (
SSN NUMBER(9,0),
First_name VARCHAR2(15),
Middle_name VARCHAR2(1),
Last_name VARCHAR2(15),
Address VARCHAR2(60),
Tel_no VARCHAR2(30)
);

A

You get an error. You can’t do that since another table is using it.

18
Q

What’s a VARRAY?

A

A datatype. It can hold up to n values.

CREATE TYPE tel_array AS VARRAY(5)
OF varchar2(15);

note: varchar2 is oracle specific.

19
Q

How would you insert into a table with a VARRAY?

A

INSERT INTO emp
VALUES ( ‘Jake’, tel_varray(‘507-344 7070’,
‘507-344 7171’,
‘612-380-2121’));

20
Q

Nested tables

A

CREATE TYPE addr_tab AS TABLE
OF Address;

CREATE TABLE emp (
name varchar2(15)
addr addr_tab
NESTED TABLE addrSTORE AS nested_address_table
);

INSERT INTO emp
VALUES(‘john’, addr_tab(Address(‘Business’, ‘121 Warren St’)));

21
Q

Selecting from RDBMS vs Selecting from ORDBMS

A

– r dbms
SELECT E.FNAME, P.PH_TYPE, P.PH_NO, A.ADDR_TYPE, A.CITY, A.STATE
FROM EMP E, ADDRESS A, PHONE P
WHERE E.EMPID = A.EMPID AND E.EMPID = P.EMPID;

– or dbms
SELECT E.EMPLOYEE.FNAME, E.EMPLOYEE.PHONE, E.EMPLOYEE.ADDRESS
FROM EMP E;

22
Q

Creating procedures in SQL (Oracle)

A

CREATE OR REPLACE PROCEDURE GetEmployeeDetails (p_employee_id IN NUMBER)
IS
BEGIN
SELECT *
FROM Employees
WHERE EmployeeID = p_employee_id;
END;

23
Q
A