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?

  1. The Relational Model - Details

Keys

A key is an attribute of the relation. There are several types of keys:

  • superkey

    • K is a superkey of R if values of K are sufficient to identify a unique tuple of each possible relation r(R)

    • Ex. {ID} and {ID,name} are both superkeys of instructor

  • candidate key

    • A candidate key is a minimal superkey

    • Ex. {ID} is a candidate key for instructor

  • primary key

    • One of the candidate keys is selected as a primary key

    • A primary key must uniquely identify a tuple

  • foreign key

    • A relation R1 may include an attribute that is the primary key of another relation R2; this attribute is called the foreign key from R1 to R2

    • R1 is called the referencing relation and R2 is called the referenced relation

    • The foreign key constraint (or referential integrity constraint) requires that the values of the attribute in the referencing relation must appear in at least 1 tuple of the referenced relation

In the university database figure (see previous section), the candidate keys for each relation have been underlined and the arrows denote foreign key dependencies.

PreviousRelationsNextRelational Query Languages

Last updated 5 years ago

Was this helpful?