관계형 데이터베이스에서 "튜플"이라는 용어는 무엇을 의미합니까?
SQL에서 튜플이 무엇을 의미하는지 설명 해주세요. 감사합니다 ..
여기에있는 대부분의 답변은 올바른 방향으로 진행되고 있습니다. 그러나 행은 튜플이 아닙니다 . 튜플*
은 이름이있는 알려진 값의 순서 가 지정되지 않은 집합입니다. 따라서 다음 튜플은 동일합니다 (관계형 튜플은 대부분 이론적 구조이므로 가상 튜플 구문을 사용합니다).
(x=1, y=2, z=3)
(z=3, y=2, x=1)
(y=2, z=3, x=1)
... 물론 x, y, z가 모두 정수라고 가정합니다. 또한 "중복"튜플과 같은 것은 없습니다. 따라서 위의 내용이 동일 할뿐만 아니라 동일 합니다. 마지막으로 튜플은 알려진 값만 포함 할 수 있습니다 (따라서 null 없음).
행**
(이들이 생략 될 수 있지만)의 이름으로 공지 된 또는 미지의 값의 순서화 된 집합이다. 따라서 다음 비교는 SQL에서 false를 반환합니다.
(1, 2, 3) = (3, 2, 1)
(3, 1, 2) = (2, 1, 3)
하지만 "가짜"방법이 있습니다. 예를 들어 다음 INSERT
문장을 고려하십시오 .
INSERT INTO point VALUES (1, 2, 3)
x가 첫 번째, y가 두 번째, z가 세 번째라고 가정하면이 쿼리는 다음과 같이 다시 작성할 수 있습니다.
INSERT INTO point (x, y, z) VALUES (1, 2, 3)
아니면 이거:
INSERT INTO point (y, z, x) VALUES (2, 3, 1)
...하지만 우리가하는 일은 순서를 제거하는 것이 아니라 변경하는 것입니다.
또한 알 수없는 값도있을 수 있습니다. 따라서 알 수없는 값이있는 행이있을 수 있습니다.
(1, 2, NULL) = (1, 2, NULL)
...하지만이 비교는 항상 UNKNOWN
. 결국 두 개의 알 수없는 값이 같은지 어떻게 알 수 있습니까?
마지막으로 행이 중복 될 수 있습니다. 즉, (1, 2)
과 (1, 2)
동일하게 비교할 수있다, 그러나 그것은 반드시 그들이 똑같은 걸 의미하지 않는다.
이것이 관심있는 주제라면 SQL 및 관계형 이론 : CJ 날짜별로 정확한 SQL 코드를 작성하는 방법을 읽는 것이 좋습니다 .
*
일반적으로 수학과는 약간 다른 관계형 모델에 존재하는 튜플에 대해 이야기하고 있습니다.
**
궁금한 점이있는 경우 SQL의 거의 모든 것이 행 또는 테이블입니다. 따라서은 (1, 2)
행이고은 VALUES (1, 2)
테이블 (한 행 포함)입니다.
업데이트 : 나는 여기 블로그 게시물 에서이 답변에 대해 약간 확장했습니다 .
그것은 "단축 것 N-tuple
"(처럼 quadruple
, quintuple
등)
전체적으로 취한 행 집합의 행입니다.
발행하는 경우 :
SELECT col1, col2
FROM mytable
전체 결과는 것 ROWSET
, 그리고 각각의 쌍은 col1, col2
될 것이다 tuple
.
일부 데이터베이스는 전체적으로 튜플과 함께 작동 할 수 있습니다.
다음과 같이 할 수 있습니다.
SELECT col1, col2
FROM mytable
WHERE (col1, col2) =
(
SELECT col3, col4
FROM othertable
)
, tuple
하나 rowset
의 전체 tuple
가 다른 전체와 일치 하는지 확인합니다 rowset
.
에서 관계형 데이터베이스 , 테이블은 관계 (수학적 의미는) . 관계는 튜플의 집합입니다. 따라서 관계형 데이터베이스의 테이블 행은 관계형 튜플입니다.
관계에 관한 위키 :
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.
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?
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.
row from a database table
Tuples are known values which is used to relate the table in relational DB.
Tuple is used to refer to a row in a relational database model. But tuple has little bit difference with row.
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.
참고URL : https://stackoverflow.com/questions/751264/what-does-the-term-tuple-mean-in-relational-databases
'program story' 카테고리의 다른 글
순수한 C로 RAII를 구현합니까? (0) | 2020.12.12 |
---|---|
GROUP BY 및 COUNT (DISTINCT)를 사용하는 LINQ to SQL (0) | 2020.12.12 |
dll에서 std :: 객체 (벡터, 맵 등)를 포함하는 클래스 내보내기 (0) | 2020.12.12 |
R로 지리 테마 맵 개발 (0) | 2020.12.12 |
jquery 문서 내부 또는 외부 함수 준비 (0) | 2020.12.12 |