Computers/Databases 12

ch 6. Formal Relational Query Languages (Part 2. Tuple Relational Calculus & Domain Relational Calculus)

Part 2. Tuple Relational Calculus & Domain Relational Calculus 관계대수는 기호의 순서에 따라, 절차에 맞게 처리해야하기 때문에 순차적이다. 하지만 6장의 관계대수 부분 다음에 나오는 아래 이야기들은 표현의 절차를 없앰으로써, 비절차적으로 수행할 수 있음을 보여준다.관계 대수에 비하여 큰 비중을 차지하지 않으나, 어떤 개념인지 파악하고 넘어가면 좋을 것 같다. Tuple Relational Calculus (튜플 관계 해석) 비절차적 쿼리 언어로서, 각 쿼리는 다음과 같은 형태를 지닌다.(db1)이 것은 조건 P를 만족하는 모든 t에 대한 집합을 나타낸다.t는 튜플변수로서, t[A]는 속성 A에 대한 튜플 t의 값을 나타낸다T[ID], t[dept_name..

Computers/Databases 2016.07.11

ch 6. Formal Relational Query Languages (part1. Relational Algebra)

ch 6. Formal Relational Query Languages Relational Algebra (관계 대수) Procedural Language (순차적 언어)Six Basic Operators (기본 연산자)연산자는 1개 혹은 2개의 릴레이션을 입력으로 받아서, 새로운 릴레이션을 결과로 출력한다.질의를 R,A로 표현 Select (선택)표기 및 정의 :p는 selection predicate p는 과 같은 기호(term)로 연결되어 구성된 명제 대수에 해당하는 식 selection 예시 Project표기 및 정의A1, A2는 속성 이름이고, r은 릴레이션 이름언급된 속성에 한하여 (언급되지 않은 속성을 제외) 해당 릴레이션의 K개의 열(columns)이 결과로 나타냄중복되는 행은 결과에서 제..

Computers/Databases 2016.07.11

seoul accord - day 4. 데이터 튜닝 (Data tuning)

◆ 데이터베이스 튜닝 ◇ 데이터베이스 성능 개선 작업 ◇ DBMS의 내부 동작에 대한 깊은 이해 필요- transaction, index ,recovery...etc. ◆ transaction - sequence of operations treated as a unit ◇ SQL에서 transaction- commit : 트랜잭션 종료- rollback : 트랜잭션 취소(롤백의 대상 : DML / insert, delete, update )-autocommit : SQL 문장 하나 단위로 트랜잭션 ~ 오버헤드가 큼 --- 롤백안된다 -- 속도도 느려짐 ◇ 트랜잭션 목적- tarnsacton - 기본 속성 : ACID -- Atomictiy / consistentcy /isolation / durabili..

Computers/Databases 2012.10.21

seoul accord - day 3. 데이터 모델링 (Data modeling)

◆ Database Design Model ◇ E/R ◇ UML ◇ 특징- graphical- relational model ◆ 일반적인 DB 모델링 단계 - 논리/개념적 설계 - 물리적 설계 - 데이터베이스 구축 - 데이터베이스 운영/모니터링 ◆ E/R ◇ Entity / Relationship / Cardinality ◇ E-R diagram : http://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model- 표기 ~ 현업에서는 crow's foot notation 많이 이용 ◇ Weak Entity set ◇ Specialization & Generalization 참고◆ table space

Computers/Databases 2012.10.21

seoul accord - day 2. SQL 기본

기본 SELECT ◆ SELECT ◇ syntax-select-from-where-group by (having)-order by (asc/desc) ◇ formatSELECT *|{[DISTINCT] column|expression [alias],...}FROM table;* 표준에 맞게 작성하자! ◆ NULL ◇ DBMS마다 NULL 처리 방식이 다름ex. ORDER BY했을 때 NULL이 먼저 나오는 경우 VS. NULL이 마지막에 나오는 경우 ◇ NVL(expr1, expr2) : expr1 이 NULL이면 expr2 출력- oracle 내장 함수. 표준은 아님 ◇ equal 갖고 비교할 수 없다 ◇ 비교하려면 IS NULL, IS NOT NULL 이용 ◆ Column Alias ◇ 컬럼의 제목 ..

Computers/Databases 2012.10.21

seoul accord - day1

◆ Database ~ set of data◆ DBMS - OLTP --- Transaction - OLAP --- Analysis - tpc --- DBMS 벤치마크 사이트 : http://www.tpc.org/ ◆ File system 문제점 - Redundancy consistency - dependency - integrity ◆ NoSQL ◆ Relational Model - Data Model --- 어떤 형태로? 데이터마다 적합 모델은 따로 ! - schema --- logical structure of DB * instance --- actual contents at a particular point in time * null --- * unknown, undefined - relation..

Computers/Databases 2012.10.21

ch5. advanced SQL

◆ Accessing SQL from a Programming Language◇ JDBC 와 ODBC --- Dynamic SQL - API - 공통된 특징 : Connect with DB server [연결] : Send SQL commands to the DB server [질의] : Fetch tuples of result one-by-one into program variables [질의결과] - ODBC : C, C++, C#, Visual Basic - JDBC : Java ◇ JDBC - Java API for communicating with database systems supporting SQL - 다양한 기능 지원 (예) 질의, 질의 결과, 데이터 업데이트.. - metadata 지원..

Computers/Databases 2012.10.21

ch4. intermediate SQL

◆ Join operation type : - inner - left outer- right outer- full outercondition : natural / on / using ( a1, ...,an ) ◆ outer join - to avoid loss of information (정보 손실을 막기 위해) - null 값까지 넣으면서 하는 이유? missing information 알 수 없음, ◆ inner join : 중복되는 attribute 다 보여줌- inner join VS natural join http://stackoverflow.com/questions/8696383/difference-between-natural-join-and-inner-join ◆ view 사용이유 : 1. ..

Computers/Databases 2012.10.21

ch3. introduction to SQL

◆ data definition language ( DDL ) DDL allows the specification of information about relations, including :- the schema for each relation- the domain of values associated with each attribute.- integrity constraints : 제약조건 (Ex. key) ◆ domain types in SQLchar(n) : 고정길이 문자열. 무조건 n만큼varchar(n) : 가변 길이. 최대 n만큼int : integersmallint : small integer numeri(p,d) : pixed point number ~ p: 숫자 전체 길이, q: 소수점..

Computers/Databases 2012.10.21