관리 메뉴

IT 컴퓨터공학 자료실

관계 대수(Relational Algebra)에 대해 본문

영어 번역 & 일본어 번역

관계 대수(Relational Algebra)에 대해

윤맨1 2015. 7. 19. 15:35

Relational algebra, first described by E.F. Codd while at IBM, is a family of algebra with a well-founded semantics used for modelling the data stored in relational databases, and defining queries on it.

 

관계 대수는 IBM에서 E.F. Codd이 처음 고안했다. 이것은 대수에서 기초가 튼튼한 의미론으로 데이터를 저장하는 데이터베이스를 모델링하고 쿼리를 정의하는 목적으로 사용되었다.

 

The main application of relational algebra is providing a theoretical foundation for relational databases, particularly query languages for such databases, chief among which is SQL.

 

관계대수의 메인 프로그램은 쿼리 랭귀지에서 이론적 토대로서 제공되며 쿼리 랭귀지에 가장 대표적인 것은 SQL을 예로 들 수 있다.

 

Relational algebra received little attention outside of pure mathematics until the publication of E.F. Codd's relational model of data in 1970. Codd proposed such an algebra as a basis for database query languages. (See section Implementations.)

 

 

 

관계 대수는 70년대 E.F. CoddRelational model에 대한 출간물이 나올 때 까지 순수수학에서 거의 관심을 받지 않았다. Codddatabase query languages에 관계 대수를 기본 토대로 잡았다.

 

Five primitive operators of Codd's algebra are the selection, the projection, the Cartesian product (also called the cross product or cross join), the set union, and the set difference.

 

Codd의 대수의 대표적인 operator 다섯 가지는 selection, projection, Cartesian product, set union, set difference가 있다.

 

Set operators

 

The relational algebra uses set union, set difference, and Cartesian product from set theory, but adds additional constraints to these operators.

 

관계 대수는 합집합, 차집합, set theory로부터 나온 카티젼 프로덕트를 사용하고, 이러한 operator는 추가적인 제약사항을 붙여 사용한다.

 

For set union and set difference, the two relations involved must be union-compatiblethat is, the two relations must have the same set of attributes. Because set intersection can be defined in terms of set difference, the two relations involved in set intersection must also be union-compatible.

 

합집합과 차집합에 대해서는, 연산하는 두 집합이 반드시 ‘compatible’ 해야 하며(형태가 맞는다는 의미), 같은 속성들을 가져야한다. 왜냐하면 집합간의 교차에서는 합집합을 하거나 차집합을 할 때 반드시 union-compatible해야하기 때문이다.

 

For the Cartesian product to be defined, the two relations involved must have disjoint headersthat is, they must not have a common attribute name.

 

카티젼 프로덕트란 두 개의 집합의 머리 부분이 어긋나야 하며, 공동된 속성명도 가지지 않아야한다. , 두 집합에서 도출될 수 있는 모든 쌍의 집합을 의미한다.

 

In addition, the Cartesian product is defined differently from the one in set theory in the sense that tuples are considered to be "shallow" for the purposes of the operation. That is, the Cartesian product of a set of n-tuples with a set of m-tuples yields a set of "flattened" (n + m)-tuples (whereas basic set theory would have prescribed a set of 2-tuples, each containing an n-tuple and an m-tuple). More formally, R × S is defined as follows:

 

또한 카티젼 프로덕트는 set theory와는 다르게 튜플들이 오퍼레이션의 목적에 대해 피상적으로 고려되어진다. 이것은 카티전 프로덕트의 n 튜플과 m 튜플을 더한 숫자만큼의 투플이 생겨난다는 의미이다.

 

 

 

Projection (π)

 

A projection is a unary operation written as  where  is a set of attribute names. The result of such projection is defined as the set that is obtained when all tuples in R are restricted to the set  .

 

프로젝션은 단항 오퍼레이션으로 위와 같은 형식으로 표현되며, 이것은 속성 이름들의 set을 의미한다. 프로젝션의 결과물로는 모든 튜플에서 원하는 한 튜플(여기서는 R)의 속성들의 집합으로 정의할 수 있다.

 


This specifies the specific subset of columns (attributes of each tuple) to be retrieved. To obtain the names and phone numbers from an address book, the projection might be written  . The result of that projection would be a relation which contains only the contactName and contactPhoneNumber attributes for each unique entry in addressBook.

 

이것은 표현될 특정 컬럼의 부분집합을 명시한다. 이름과 핸드폰 번호를 전화번호부에서 찾고 싶다면 위와 같이 표현할 수 있다. 위의 프로젝션의 결과는 contactNamecontactPhoneNumber을 전화번호부에서 표현할 수 있다.

 

 

 

Selection (σ)


 

A generalized selection is a unary operation written as  where  is a propositional formula that consists of atoms as allowed in the normal selection and the logical operators    (and),  (or), and  (negation). This selection selects all those tuples in R for which  holds.

 

보통 셀렉션은 단일 오퍼레이션으로서 위와 같이 표현된다. 위의 표현은 보통의 셀렉션과, and/or/not 오퍼레이터들을 원자적으로 허용한 명제식으로 표현된다.

 

To obtain a listing of all friends or business associates in an address book, the selection might be written as  . The result would be a relation containing every attribute of every unique record where isFriend is true or where isBusinessContact is true.

 

전화번호부에서 all friends business associates의 목록을 얻으려면, 위와 같은 셀력션 식으로 표현한다. 결과는 isFriendtrue거나 isBusinessContacttrue인 모든 레코드를 포함한 테이블이 생성된다.

 

In Codd's 1970 paper, selection is called restriction.

 

70년대의 문서에서는 셀렉션을 restriction라고 불렀다고 한다.

 



출처 : https://en.wikipedia.org/wiki/Relational_algebra