Documente Academic
Documente Profesional
Documente Cultură
2
Deleting a Database Instance
3
Other DDL Commands
4
Steps in Creating a Table
6
Create Table Construct
7
Integrity Constraints
8
Domain Integrity Constraints
10
Referential Integrity Constraint
11
Referential Integrity Constraint
Ensures that foreign key values of a table must match
primary key values of a related table.
[CONSTRAINT] FOREIGN KEY (col_name,...)
REFERENCES targer_table_name
(target_table_primary_column,...)
Example
createtable Student
(sid integer AUTO_INCREMENT,
name char (30), Column names could
pid integer, be different
primary key (id),
foreign key (pid) references Program (pid))
13
Complete Foreign Key Declaration
Referential
integrity
constraints are
drawn via arrows
from dependent
to primary table
15
Drop and Alter Table Constructs
16
Views
17
View Definition
18
View Usage
19
View Types
Dynamic View
Avirtual table created dynamically
No data actually stored; data from the base table is
made available to user on request.
Based on SELECT statement on base tables or other
views
Materialized View (Supported in Oracle, for instance)
Copy or replication of data
Data actually stored on the disk
Refreshed periodically (or on every change) to match
the corresponding base table data
20
More on Views
21