ERD – Translating ERD Diagrams into SQL DDL Statements

ddlerd

I am currently establishing a database for Students and Courses using ERD. The style of ERD I am using is similar to the diagram below from the ERD Diagram Question:

enter image description here

Note: The picture above is NOT my ERD, this is just the style of ERD I am using.

A simple CREATE statment could be used for the attributes of each entity, but what other DDL statements enforce relationships, weak entities, and multi-way relationships?

Best Answer

The way you can enforce relationships between tables is by creating a foreign key which is referencing a primary key from other table. Both keys are defined either creating or modifying the table by using CREATE statement or ALTER statement, respectively.