1 / 3

For student, require values for name and address.

For student, require values for name and address. For advisor, require values for name, phone, and email. For advisor, make values for email unique. SQL DDL Example. CREATE TABLE student (pid varchar(9), name varchar(25) NOT NULL, address varchar(50) NOT NULL, phone varchar(15),

duscha
Download Presentation

For student, require values for name and address.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. For student, require values for name and address. For advisor, require values for name, phone, and email. For advisor, make values for email unique.

  2. SQL DDL Example CREATE TABLE student (pid varchar(9), name varchar(25) NOT NULL, address varchar(50) NOT NULL, phone varchar(15), email varchar(25), PRIMARY KEY (pid)); CREATE TABLE advisor (emp_id varchar(5) CONSTRAINT pk_adv PRIMARY KEY, name varchar(25) NOT NULL, office varchar(25), phone varchar(6) NOT NULL, email varchar(25) NOT NULL, UNIQUE (email));

  3. SQL DDL Example CREATE TABLE st_adv (pid varchar(9) CONTRAINT fk_st REFERENCES student(pid) ON DELETE CASCADE ON UPDATE CASCADE, emp_id varchar(5), PRIMARY KEY (pid, emp_id), FOREIGN KEY (emp_id) REFERENCES advisor(emp_id) ON DELETE CASCADE ON UPDATE CASCADE; CREATE INDEX sid_x ON student(pid); CREATE INDEX emp_x ON advisor(emp_id); CREATE INDEX adv_stx ON st_adv(pid, emp_id);

More Related