Consider the E-R diagram depicted in Figure 4.38. Write down the corresponding relational schema using SQL. Include all keys and other applicable constraints.

What will be an ideal response?

```
CREATE TABLE Student (
Id INTEGER,
Name CHAR(20),
Major CHAR(3),
PRIMARY KEY (Id, Major) )
```
```
CREATE TABLE Class (
Semester CHAR(5),
CrsCode CHAR(6),
Room CHAR(15),
PRIMARY KEY (Semester, CrsCode) )
```
```
CREATE TABLE Takes (
StudId INTEGER NOT NULL,
Semester CHAR(5) NOT NULL,
CrsCode CHAR(6) NOT NULL,
FOREIGN KEY (Semester,CrsCode) REFERENCES Class,
FOREIGN KEY (StudId) REFERENCES Student (Id) )
```

Computer Science & Information Technology

You might also like to view...

Traditional network used a head end and a series of coaxial cables and amplifiers to connect to all receiving homes

a. true b. false

Computer Science & Information Technology

Once you begin to modify it, the name of the gradient in the Name text box changes to ____.

A. New B. Custom C. Unused D. Ramped

Computer Science & Information Technology