More SQL DDL




CS157a

Chris Pollett

Nov 13, 2023

Outline

Introduction

Virtual Views

Querying Views

Renaming View Attributes

Quiz

Which of the following is true?

  1. SQL doesn't allow you to have a subquery on the FROM line of a query.
  2. The natural join of table R and S could be computed in SQL as:
    SELECT *
    FROM (R NATURAL JOIN  S);
    
  3. Foreign key constraints in SQL are typically handled using triggers.

Modifying Views

Updatable View Conditions

Example Updatable View

Instead-of Triggers on Views

Indexes in SQL

SQL Index Syntax

Materialized Views