HJW's IT Blog

Database: 2주 - 2 본문

카테고리 없음

Database: 2주 - 2

kiki1875 2023. 9. 3. 13:26

# SQL : Standard Query Language

    > SQL Data Types

        >> Table, Row, Column

        >> SQL DDL: CREATE, ALTER, DROP     

        >> Schema Evolution

            -> Schema를 다음 방법들로 변경 (dropping tables, attributes, constraints)

 

    > Schema & Catalog Concepts

        >> Schema 

          -> 같은 DB application 내의 Table 과 다른 constructs 

          -> Schema name, auth ID, descriptors

          -> Elements : Tables, constraints, views, domains ....

          { CREATE SCHEMA COMPANY AUTHORIZATION 'Jsmith';}

       >> Catalog

          -> SQL 환경에서 스키마의 모음

          -> Catalog 는 INFORMATION_SCHEMA를 항상 포함한다

             {auth user 들에게 모든 schema 의 설명에 대한 정보 제공}

 

    > DATA TYPES

       >> Numeric: int, float 등

       >> Character string: Char, VarChar

       >> Bit string: Bit, etc

       >> Boolean

       >> Date and Time { Date(YYYY-MM-DD), Time (HH:MM:SS)}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

    > Specifying Attribute Constraints and Attribute Defaults

        >> NOT NULL

            -> Null 은 특정 속성에는 불가능

        >> DEFAULT <value>

        >> CHECK clause

 

    > Specifying Key and Referential Integrity Constraints

        >> PRIMARY KEY clause

            -> Dno INT PRIMARY KEY

        >> UNIQUE clause

            -> Dname VARCHAR(15) UNIQUE

        >> FOREIGN KEY clause 

        >> Constraints Name

    > Referential Integrity

        >> FK 와 관련 튜플들 사이의 일관성을 유지하기 위한 규칙

        >> Options: SET NULL, CASCADE , SET DEFAULT

 

CHECK 문

RESTRICT

    - 다른 constraints 에서 참조되지 않을경우 삭제

 

CASCADE

    - 모든곳에서 삭제

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

    > Basic Queries in SQL

        >> SELECT 

        >> SQL 의 특성

            -> SQL 은 여러 동일한 튜플이 존재할 수 있다

            -> 몇몇 SQL 관계는 집합으로 묶여있다

 

    > SELECT - FROM - WHERE