Tuples in a database

Asked

Viewed 13,017 times

7

I know what a Python tuple is but not in a database, so follow the question:

What is a tuple in the database context?

1 answer

9


Tupla is a vessel (literal translation) where it places a lot of things. Roughly we refer to it as being the line the table, or the record, as the concept is also known. But let’s be more specific.

By mathematical definition it is an ordered and finite sequence of elements. Each element has an identifier name (not every tuple needs to have one) and a value.

Then in the database would be you join the necessary data to fill what the table expects in only one conceptual drive.

At the time of INSERT we see the tuple very clearly. Example:

INSERT (id, nome, idade, salario) VALUES (1, "joão", 25, 1000.00);

I put in the Github for future reference.

There we have a tuple formed by the names (id, nome, idade, salario) and the other with values (1, "joão", 25, 1000.00), as you are used to in Python and other languages.

Note that for the context, without the names is not a tuple, it is only a line, although it is common for people to use the term interchangeably, in the definition of some in the context of database.

Related.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.