Chapter 1 - User-defined types and typed tables Flashcards

1
Q

What are the basic OO features that must be supported in an ORDBMS?

A
Object identity
classes or types
inheritance
encapsulation
overriding + late binding
complex objects
completeness (for method implementation)
extensibility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the key features and benefits of USER-defined types?

A
  • extend DBS functionality + flexibility
  • strong typing
  • information hiding (no impl. details)
    Benefits:
  • Reuse: overloading + inheritance
  • change: isolation + low impact
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In which sense do UDTs support strong typing?

A
  • type checking can be enhanced with semantics -> not based just on primitive types.
    Shoe size different of room area -> but both integers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does the cast mechanism of distinct types work?

A

DT: Renamed type with different semantics (share interval representation)
Cast: allows comparison/ordering based os source type/ create DT values from literals, etc..
* cast functions automatically created (CAST (SOURCE AS DISCTINCT) WITH F)

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

How can we ensure the compatibility between source and distinct type without explicit casting?

A

Relaxed strong typing for assignments USING CAST FUNCTIONS:
CAST (SRC AS DST) WITH F AS ASSIGNMENT
* comparison requires explicit casts *

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

How to distinct types compare to domains in the relational model?

A

in rel. model -> domain = type

in SQL -> domain = type + constraint + default + collation (CREATE DOMAIN)

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

What are the intensional and extensional aspects of Structured Types?

A
  • Intention = description = type/class -> UDTs
    - > concerns interface and substitution inheritance (operations)
  • Extension = actual things = set of objects -> typed tables
    - > Concerns instantiated objects and inclusion inheritance (structure/state)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are the different ways in which objects (i.e. instances of structured types) may exist?

A

Object as values: Values of a ST (columns, attr. of other ST, domains, variables, expressions)
-> no identity, no state modifications
Objects as rows: in typed tables (oid column = identity, update statement = modification

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

What are two possible instantiation mechanism of structured types

A
  • System-supplied constructor function type-name ->returns obj with default values
  • NEW operator -> calls user-defined constructor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can we access the attributes of an object in the query language?

A
  • dot notation for objects as value (a.b.c.d)
  • SELECT or UPDATE of columns for typed tables
  • ”->” for referenced stored in tables = DEREF followed by dot
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How are subtyping and inheritance realized with structured UDTs?

A

Just like OO languages
CREATE TYPE … UNDER … -> inherits attributes and methods
**substitutability implied

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

What are the equivalent of abstract and final classes in an ORDBMS?

A
  • Abstract= NOT INSTATIABLE (no system-supplied constructor)

* final = not supported -> all DTs are final, all STs are not final.

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

What is the meaning of subtype substitutability and how is it realized in an ORDBMBS?

A

B < A -> B supports at least the operations defined in A and B can be used everywhere an A is expected.
**obs: invariant return , argument and attribute types

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

How can we test for the type of an object in SQL?

A
  • Determination of dynamic type. IS OF (boolean = instance of)
  • subtypes out: ONLY(type) (type == getClass( ))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are typed tables and what characteristics do they provide to objects?

A

tables whose columns are attributes of an ST and rows are objects with an identity
-> provide identity + persistence + update capability

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

How can we modify the state of objects in typed tables?

A

modify obj attributes by updating column values

17
Q

How do table hierarchies relate to type hierarchies?

A

(Table inherits constraints, triggers, etc)

  • typed table can be declared under another typed table of a super type
  • *but columns only of the super-type table
  • > to exclude subtypes-> FROM ONLY table
18
Q

How is the concept of object identity supported in ORDBSs?

A

(identity->existence != values) (sharing, updates, references….)
Primary keys not enough: modifiable, not uniform across tables, require join to navigate into obj
*Solution: oid column (pk) maintained by system + reference types.

19
Q

What are the variation criteria for object identity in ORDBMSs?

A
  • externall/internal *system/user generated (define identity upon creation)
  • Scope of uniquenes (maximal type in table hierarchy)
  • reusability (reusing id of deleted obj)
20
Q

What are reference types and different approaches for their representation?

A

Used to reference instances of STs stored in typed tables

  • > user generated (REF USING )
  • > System generated (REF is system gen.)
  • > Derived from other attrs (REF FROM (…))
21
Q

Give an overview over the general use of reference types in the query language

A
  • Insertion
  • > User gen.: Like any other, with costs provided
  • > System gen.: retrieved from destination table on a subquery
  • Strong typing
  • > Comparison/assignment requires some REF type
  • > Substitutability supported: REF(sub) compatible with REF(super)
22
Q

What is the requirement on a reference type in order to allow dereferencing it?

A
  • Must be scoped (limited to single table)
    why?:
    -> Dynamic checks (delete, authorization …)
    ->Updates
23
Q

What are path expressions and how do they work when scoped references are used?

A

Scoped references: When creating table, specify precisely the table in which referenced objects are stored (ref-attribute-name) WITH OPTIONS SCOPE [references are checked]
path expressions:
ref-of-attributte
acesses: a->b.c

24
Q

What is the functionality of the DEREF operator?

A

Retrieve object (structured type value) from reference

25
Q

What is the relation between reference types and referential constraints?

A
  • > Ref. constraints specify inclusion dependencies (no dereferencing)
  • > no strong typing
26
Q

How do the operators ONLY and IS OF work when applied to typed tables?

A
  • > DEREF (obj) IS OF (type)

- > SELECT … FROM ONLY (super)

27
Q

What are the different forms of equality and how are they used in SQL?

A
  • > Shallow-equality of objects = reference attributes compared by identity
  • > deep-equality = derefs nested objects, comparing atomic values by deep equality
28
Q

What is the goal of UDT ordering and the different types of comparison supported?

A

Goal: allow comparison (equality) of objects
types: EQUALS ONLY (=, !=), ORDER FULL (all)

29
Q

What are different approaches for defining ordering fnctions and in which scenarios are they allowed?

A

STATE: Function automatically created, comparing attributes pair wise (equals) **2 param
RELATIVE: Specify function to compare two objects of the same type and return integer (compare to) **2 parameters
MAP: Map object to predefined type and compare them normally (hash code) **1 param

30
Q

Explain the concept of comparison type.

A

Nearest supertype for which comparison was defined

comparison = ordering of comparison type

31
Q

What is the goal of USER-defined Casts?

A
Allow values to be cast to other types
-> from/to UDTs and reference type
CREATE CAST (T1 AS T2) WITH FUNCTION F(T1) [AS ASSIGNMENT]