The Relational Model
database
entity
a formal name for a thing that is being tracked one theme or topic
(just single table)
Relation
- a
two-dimensional table
that has specific charateristics - Cell of the table hold single value
- All entries in a column are of the same kind
- No two rows in a table are identical
domain & cartesian product
- domain: set of possible values for a column
cartesian product
: set of all possible combinations of rows from two tables
Presenting Relation Structures
RELATION_NAME(PrimaryKey, ForeignKey, ColumnName, …)
key
identify
a row- Unique Key(Primary Key)
- NonUnique Key(Foreign Key)
Composite Key
: Primary key가 두개 이상. Surrogate Key로 대체되곤 함.Candidate Key
: unique한 columnsSurrogate Key
: 자동으로 할당되는 일련번호
IDENTITY (start, increment)
Referential Integrity Constraint
- 모든 foriegn key는 존재하는 primary key와 매칭되야한다.
Null values
- required, allow nulls 설정으로 null값을 허용할지 결정