Discuss how the proposed SQL:2011 standard will handle object identity and give an example of its intended use.
What will be an ideal response?
Object identity in SQL:2011 achieved through a referenceable base table. For example:
CREATE TABLE Person OF PERSON_TYPE (
REF IS oid SYSTEM GENERATED);
CREATE TYPE STAFF_TYPE UNDER PERSON_TYPE AS (
staffNo VARCHAR(5) NOT NULL UNIQUE,
nextOfKin REF(PERSON_TYPE)
REFERENCES ARE CHECKED ON DELETE
CASCADE,
branchNo VARCHAR(3) NOT NULL)
NOT FINAL;
CREATE TABLE Staff OF STAFF_TYPE (
PRIMARY KEY staffNo);
Unfortunately, there is an added complication that the reference type REF(PERSON_TYPE) could refer to a row in any table having rows of type Person_Type. For example, we may create another table based on Person_Type as follows:
CREATE TABLE AnotherPersonTable OF PERSON_TYPE (
REF IS oid SYSTEM GENERATED);
To limit the references to a specific table, a SCOPE clause can be added to the Staff table:
CREATE TABLE Staff OF STAFF_TYPE (
PRIMARY KEY staffNo,
nextOfKin SCOPE Person);
References can be used in path expressions that permit traversal of object references to
navigate from one row to another. To traverse a reference, the dereference operator (–>) is
used.
You might also like to view...
If the following pseudocode was coded and executed, what would display?
``` Declare String str = "ABC" Display str[1] ``` a. A b. B c. C d. ABC
Songs stored on a CD can be inserted to play at the beginning and end of speaker-led presentations
Indicate whether the statement is true or false
When a program contains a global variable and a local variable with the same name, the global variable takes precedence when its function is called.
Answer the following statement true (T) or false (F)
Answer the following statements true (T) or false (F)
1) A foreign key must reference a primary key in another table, and both keys must have same column name. 2) If you try to enter value ‘Database’ in a CHAR(4) column, only ‘Data’ will be stored in it. 3) Value ‘Basketball’ will be stored with five trailing spaces in a VARCHAR2(15) column. 4) A composite primary key can be defined at table level only.