Use SQL:2003 and its MULTISET construct to represent a bank database with UDTs for accounts, customers, and transactions.

What will be an ideal response?



CREATE TYPE AcctType AS (
Number INTEGER,
Type CHAR(1), -- e.g., ’s’ for savings
Balance DECIMAL(10),
Owners REF(Customer MULTISET~),
-- Note: we embed transactions directly in the data type for accounts
Transactions TransactionType MULTISET );
CREATE TABLE Accounts OF AcctType;

CREATE TYPE CustomerType AS (
Id INTEGER,
Name CHAR(20),
Address ROW(Number INTEGER, Street CHAR(40),
Town CHAR(30), Zip CHAR(5)),
Accounts REF(AcctType MULTISET ));

CREATE TABLE Customers OF CustomerType;

CREATE TYPE TransactionType AS (
TrId INTEGER,
Date DATE,
Type CHAR(1), -- E.g., ’w’, ’d’
Amount INTEGER );


Alternatively, we could have used the row type

ROW(TrId INTEGER, Date DATE, Type CHAR(1), Amount INTEGER)


directly in the declaration of the attribute Transactions in the UDT AcctType.

Computer Science & Information Technology

You might also like to view...

A variable that keeps track of the number of passes through a loop is known as a(n) __________.

Fill in the blank(s) with correct word

Computer Science & Information Technology

All exception classes inherit, either directly or indirectly, from ________.

a. class Error. b. class RuntimeException. c. class Throwable. d. None of the above.

Computer Science & Information Technology

What is the difference between a network's physical topology and its logical topology?

What will be an ideal response?

Computer Science & Information Technology

For published clip art, even if you cannot track it to its original source, it is likely safe to use.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology