Lab7 - Physical ERD (Power Designer)
Lab7 - Physical ERD (Power Designer)
1
1. Steps for creating conceptual data model on Power Designer:
1. Open power designer
2. Create new conceptual data model
2
4. Double click on added entity, then set entity information
5. Set student entity attributes: go to attributes tab then specify each attribute type
and name.
M ➔ mandatory attribute
P ➔ primary key
3
6. Press ok to save changes
4
8. Declare relationship between tables
5
Final conceptual Data model
6
The physical data model will be as follows:
7
3. Generate the script that will be implemented in SQL Server Management
Studio:
After generating the physical data model, click on Database tab then choose Generate
Database.
Generated SQL:
CREATE TABLE Professor
(
PID INT NOT NULL,
PName VARCHAR(25) NOT NULL,
Email VARCHAR(30) NOT NULL,
Address VARCHAR(50) NOT NULL,
PRIMARY KEY (PID)
);
8
CREATE TABLE Course
(
CID INT NOT NULL,
CName VARCHAR(25) NOT NULL,
Description VARCHAR(50) NOT NULL,
PID INT NOT NULL,
PRIMARY KEY (CID),
FOREIGN KEY (PID) REFERENCES Professor(PID)
);
9
CREATE TABLE Requires
(
CID_1 INT NOT NULL,
RequiresCID_2 INT NOT NULL,
PRIMARY KEY (CID_1, RequiresCID_2),
FOREIGN KEY (CID_1) REFERENCES Course(CID),
FOREIGN KEY (RequiresCID_2) REFERENCES Course(CID)
);
Database Diagram in SQL
10