Jerry's Blog

Recording what I learned everyday

View on GitHub


8 October 2019

Database(16) -- Review(1)

by Jerry Zhang

A data model

structure of the data. Operations on the data. Constraints on the data.

Two data models

  1. The relational model, including the object-relational extension.
  2. The semistructured-data model, including XML and related standards.

A set of attributes forms a key for a relation if we do not allow two tuples in a relation instance to have the same values in all the attributes of the key.

Relations in SQL

three kinds of relations:

  1. Stored relations, which are called tables.
  2. Views, which are relations defined by a cumputations.
  3. Temporary tables, which are constructed by the SQL language processor when it performs its job of executing queries and data modifications.

CREATE TABLE

Data types

  1. Character strings of fixed or varying length.
  2. Bit strings of fixed or varying length.
  3. The type BOOLEAN denotes an attribute whose value is logical. TRUE, FALSE, UNKNOWN
  4. The type INT or INTEGER denotes typical integer values. SHORTINT
  5. FLOAT or REAL; higher precision: DOUBLE PRECESION
  6. DATE and TIME
tags: Database