18
SQL Demo: Student-Teacher Database Dr. Richard E. Turner ([email protected])

SQL Demo: Student-Teacher Databaselearning.eng.cam.ac.uk/pub/Public/Turner/Teaching/student-teacher... · SQL Demo: Student-Teacher Database Dr. Richard E. Turner ([email protected])

  • Upload
    lytu

  • View
    220

  • Download
    1

Embed Size (px)

Citation preview

SQL Demo: Student-Teacher Database

Dr. Richard E. Turner ([email protected])

Student-Teacher Database

student enrolls course

CourseNo Course

lectured by

lecturer

SupNo SupName

M M

M

1

supervisor

M

LecNo Lecturer

StuNo StuName

The Tables

Viewing tables

Viewing tables

Schema (table schemes)

Projection (repeated elements)

Projection (no repeated elements)

Projection (identity projection)

Selection (simple)

Selection (complex)

Selection and Projection combine

Cartesian Product

Cartesian Product

Cartesian Product + Selection = Join

Simple query: step 1

Simple query: step 2

Simple query: step 3