Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tuples vs records

Tags:

What is difference between tuples and records?

like image 413
rookie Avatar asked Nov 18 '10 06:11

rookie


People also ask

What is the difference between tuple row and record?

A row, or record, is also known as a tuple. The columns in a table is a field and is also referred to as an attribute. You can also think of it this way: an attribute is used to define the record and a record contains a set of attributes.

What is tuple and record in database?

A Tuple in DBMS is just a row that contains inter-related data about a particular entity. Tuple is also called "record" in DBMS. Tuples are mostly used in Relational Databases Management Systems (RDBMS).

Is a row a tuple?

In relational databases, a tuple is one record (one row). The information in a database can be thought of as a spreadsheet, with columns (known as fields or attributes) representing different categories of information, and tuples (rows) representing all the information from each field associated with a single record.

What is difference between tuple and attribute?

An attribute value is an attribute name paired with an element of that attribute's domain, and a tuple is a set of attribute values in which no two distinct elements have the same name. Thus, in some accounts, a tuple is described as a function, mapping names to values.


Video Answer


1 Answers

Both are product types which let you build types from multiple simpler types. Some languages treat tuples as a kind of record.

Definitions

A tuple is an ordered group of elements, like (10, 25).

A record is typically a group of named elements like { "x": 10, "y": 25 } where the value has two fields labelled x and y and the value of field x is 10.

Etymology

The word "tuple" comes from the common "-tuple" suffix on "quintuple", "sextuple", "septuple", "octuple" which mean groups of 5, 6, 7, and 8 respectively.

The word "record" comes from data tables. You can think of all possible tuples with x and y fields as a table where columns correspond to fields and rows collect all the fields for a particular record instance.

 value address     field x    field y  0xABCD            10         25  0x1234            42         "xyz" 

Equivalence of product types

You can treat a tuple as a kind of record, where the index of an element in a tuple is its name within the equivalent record, so (10, 25) is { "0": 10, "1": 25 }. I believe Standard ML and related languages use records as the basic unit of type conjunction (algebraic data types provide type disjunction) and treat tuples as a kind of record in this way.

like image 150
Mike Samuel Avatar answered Sep 29 '22 12:09

Mike Samuel