Multiset types - sql, PL-SQL Programming

Multiset types - SQL

An SQL multiset is what in mathematics is also known as a bag-something like a set except that the same element can appear more than once. The body of an SQL table is in general a bag of rows, rather than a set of rows, because SQL does indeed permit the same row to appear more than once in the same table. Although SQL has no names for table types, it does support multisets in general and it does have names for multiset types. A multiset type name consists of a type name followed by the key word MULTISET. For example, INTEGER MULTISET is the name of the type each of whose values is either (a) a bag, consisting of zero or more appearances of each value of type INTEGER and zero or more appearances of the null value of type INTEGER, or (b) the null value of type INTEGER MULTISET.

It would seem at first glance, then, that we perhaps do have a type name for a table type after all. For example, our enrolments table could perhaps be of type

ROW ( Name VARCHAR(50), StudentId VARCHAR(5),

CourseId VARCHAR(5) ) MULTISET

In fact one could declare a local variable to be of this type and its value could indeed consist of the rows. However, such a type cannot be the declared type of a base table, in spite of the fact that the elements of a base table are indeed rows of the same type. Moreover, as I have already mentioned, there is such a thing as the null value of that multiset type, whereas NULL can never appear in place of a table-no table expression in SQL can ever evaluate to NULL-nor can NULL appear in place of a row in a table. So the set of values of a multiset type whose element type is a row type includes bags that are not tables as well as bags that are.

Posted Date: 1/18/2013 2:12:50 AM | Location : United States







Related Discussions:- Multiset types - sql, Assignment Help, Ask Question on Multiset types - sql, Get Answer, Expert's Help, Multiset types - sql Discussions

Write discussion on Multiset types - sql
Your posts are moderated
Related Questions
i NEED TO CREATE 3 guiS IN pl/sql sERVER PAGE FORM

a. Write an anonymous block that contains a PL/SQL function. Given an order number orderNo, the function will calculate the total number of the parts in the order. Then the anonym

Data Types and Representations This explains the concept possible representation, abbreviated possrep, and explains how these can be used in conjunction with constraints to de

BETWEEN Operator The operator BETWEEN, tests whether the value lies in a specified series. That means "greater than or equivalent to low value and less than or equivalent to hig

Object Type: The object type is a user-defined composite datatype which encapsulates a data structure along with the functions and procedures required to manipulate the data

Complete the following steps to create a procedure to calculate the tax on an order. The BB_TAX table contains the states that require taxes to be submitted for Internet sales. If

When Are Constraints Checked Under the model constraints are conceptually checked at all statement boundaries (and only at statement boundaries). By default the same is true

Attributes: Just similar to variable, an attribute is declared with a name and datatype. The name should be exclusive within the object type. The datatype can be any Oracle ty

Subprograms The PL/SQL has two types of subprograms known as the procedures and functions that can take parameters and be invoked. As the following example represents, a subp

Using the BULK COLLECT Clause The keywords BULK COLLECT specify the SQL engine to bulk-bind output collections before returning them to the PL/SQL engine. You can use these ke