Please explain what is meant by tuples in sql?Thanks..
This question is related to
sql
terminology
rdbms
definition
tuples
In relational databases, tables are relations (in mathematical meaning). Relations are sets of tuples. Thus table row in relational database is tuple in relation.
Wiki on relations:
In mathematics (more specifically, in set theory and logic), a relation is a property that assigns truth values to combinations (k-tuples) of k individuals. Typically, the property describes a possible connection between the components of a k-tuple. For a given set of k-tuples, a truth value is assigned to each k-tuple according to whether the property does or does not hold.
tuple = 1 record; n-tuple = ordered list of 'n' records; Elmasri Navathe book (page 198 3rd edition).
record = either ordered or unordered.
As I understand it a table has a set K of keys and a typing function T with domain K. A row, or "tuple", of the table is a function r with domain K such that r(k) is an element of T(k) for each key k. So the terminology is misleading in that a "tuple" is really more like an associative array.
Tuple is used to refer to a row in a relational database model. But tuple has little bit difference with row.
It's a shortened "N-tuple
" (like in quadruple
, quintuple
etc.)
It's a row of a rowset taken as a whole.
If you issue:
SELECT col1, col2
FROM mytable
, whole result will be a ROWSET
, and each pair of col1, col2
will be a tuple
.
Some databases can work with a tuple as a whole.
Like, you can do this:
SELECT col1, col2
FROM mytable
WHERE (col1, col2) =
(
SELECT col3, col4
FROM othertable
)
, which checks that a whole tuple
from one rowset
matches a whole tuple
from another rowset
.
row from a database table
Tuples are known values which is used to relate the table in relational DB.
A tuple is used to define a slice of data from a cube; it is composed of an ordered collection of one member from one or more dimensions. A tuple is used to identify specific sections of multidimensional data from a cube; a tuple composed of one member from each dimension in a cube completely describes a cell value.
Whatever its use in mathematics, a tuple in RDBMS is commonly considered to be a row in a table or result set. In an RDBMS a tuple is unordered. A tuple in an MDDBMS is the instance of data in a cell with its associated dimension instances (members).
What is the tuple in a column family data store?
Source: Stackoverflow.com