COP 4710 Lecture Notes - Lecture 7: Data Definition Language, Data Integrity, Relational Algebra
Document Summary
The schema for each relation, including attribute types. The set of indices to be maintained for each relations. The physical storage structure of each relation on disk. Di is the data type of attribute ai. Example: create table branch (branch_namechar(15), char(30), branch_city assets integer) Fixed length character string, with user-specified length n. varchar(n) . Variable length character strings, with user-specified maximum length n. int . Integer (a finite subset of the integers that is machine-dependent). smallint . Integrity constraints on tables not null primary key (a1, , an ) Add a new tuple to account insert into account values ("a-9732", "perryridge", 1200) Insertion fails if any integrity constraint is violated. Delete all tuples from account delete from account. Note: will see later how to delete selected tuples. The drop table command deletes all information about the dropped relation from the database. All tuples in the relation are assigned null as the value for the new attribute.