Edit the logical schema

Restructuring and translation produce a complete logical schema. This step prepares it for the DBMS by defining data types, column order, unique constraints, and the final SQL code, while remaining independent of any specific database platform.

  • Data types. Every column starts as INTEGER. Select a column and click Type to choose another. The list contains the most standard types, so that the SQL works on as many DBMSs as possible (see Notation).
  • Column order. Translation places columns in an arbitrary order. Move → Up / Down restores the desired one. Primary key columns always come first.
  • Unique constraints. Unique toggles a single-column UNIQUE constraint. Primary keys are unique already.
  • Names. Rename changes table and column names.

The SQL panel contains the DDL statements: tables, columns, primary keys, unique constraints and foreign keys. Attributes with a minimum cardinality of one translate to NOT NULL columns, while optional attributes are nullable.

CREATE TABLE EXAM (
    STUDENT_StudentId INTEGER NOT NULL,
    COURSE_Code VARCHAR(100) NOT NULL,
    Date DATE NOT NULL,
    Mark INTEGER NOT NULL,
    PRIMARY KEY (STUDENT_StudentId, COURSE_Code),
    FOREIGN KEY (STUDENT_StudentId) REFERENCES STUDENT (StudentId)
    …
);

Edit ER returns to the design stage.