CS-GY 6083: Principles of Database Systems
1.0.0
1.0.0
  • Introduction
  • DBMS Basics
    • Introduction to DBMS
    • Why use a DBMS instead of a File System?
    • Levels of Abstraction
    • Instances and Schemas
  • Data Models
    • Introduction to Data Models
    • Database Languages
    • Database Design
  • DBMS Internals
    • Introduction to DBMS Internals
    • Storage Manager
    • Query Processor
    • Transaction Management
    • Database Users
    • Database Architecture
  • DBMS History
  • Some Popular Database Systems
  • OLTP, OLAP, and Data Mining
  • Databases vs. Information Retrieval
  • The Entity-Relationship Model - Details
    • Introduction
    • Cardinality Constraints
    • ER Diagram Components
    • ER Diagram to Relational Schema
    • Design Issues
  • The Relational Model - Details
    • Relations
    • Keys
    • Relational Query Languages
      • Relational Algebra
      • Relational Calculus
      • Relative Expressive Power
    • Relational Operators
  • SQL
    • Introduction to SQL
    • Domain Types in SQL
    • DDL Commands
      • Creating a Table
      • Alter and Drop
    • DML Commands
      • Basic Query Structure
      • Select
      • From
      • Where
      • Joins
      • Rename
      • String Operations
      • Ordering
      • Set Operations
      • Group By and Having
      • Nested Subqueries
      • Test for Empty Relations
      • Test for Duplicate Tuples
      • Derived Relations
      • With
      • Database Modification
    • Intermediate SQL
      • Joins Revisited
      • Views
      • Transactions
      • Integrity Constraints
      • More SQL Data Types and Schemas
        • Other Features
      • Authorization
    • Advanced SQL
      • Accessing SQL From a Programming Language
        • ODBC and JDBC
        • Embedded SQL
        • PHP
        • Some Security Issues
      • Accessing Metadata
      • Text Operations
        • Like
        • Contains
      • Cursors
      • Functions and Procedures
        • Procedural Constructs
        • External Language Routines
      • Triggers
      • Ranking
      • Windowing
      • OLAP
Powered by GitBook
On this page

Was this helpful?

Last updated 5 years ago

Was this helpful?

A relational database contains multiple tables/relations.

A relation is a set of tuples where each attribute is part of a domain.

Relations are represented as tables.

The columns of the table represent attributes of the relation and the rows/tuples represent the relationship between the entities i.e. the values for the relation.

The following is an example of a relation:

More about attributes

  • The set of allowed values for an attribute is called the domain of the attribute

  • Attribute values are atomic i.e. indivisible (they can't be divided into sub-domains)

  • The special value null is a member of every domain; it means that the value is not available or is unknown

  • This null value may cause complications in the definition of many operations

  • Aggregate functions ignore null values

Relational Schema and Instance

A relational schema consists of a set of attributes and their domains.

An relation instance refers to the tuples of a relation at a particular point in time. It is denoted as a table.

Note that relations are unordered i.e. the order in which the tuples are present in the table is irrelevant.

Database

A database consists of multiple relations.

For example, a university database can have relations including student, instructor, advisor, department etc.

It is good to have separate relations instead of combining all the attributes into a single table. If we use a single table to represent everything, there would be two main issues:

  • redundancy: ex. more than one student having the same instructor

  • null values: ex. a student who doesn't have an advisor

The following figure illustrates the university database:

Best practices to design "good" relational schemas will be discussed under normalization theory.

where are attributes of the relation.

R=(A1,A2,...,An)R = (A_1, A_2, ..., A_n)R=(A1​,A2​,...,An​)
A1,A2,...,AnA_1, A_2, ..., A_nA1​,A2​,...,An​
  1. The Relational Model - Details

Relations

PreviousThe Relational Model - DetailsNextKeys
  • More about attributes
  • Relational Schema and Instance
  • Database