mysqlsqlentity-relationshippartialdiagrams

representing total partial participation in sql / mysql from er diagrams


In an ER diagram, you can represent participation by normal line / thick line from an entity to a relationship.

*How do you represent participation when you make an SQL table?

*can you have strong entities that require total participation in a relationship?

*Can an entity (or table, once it's been converted to sql table) be in total participation to multiple relationships? Again how would that be represented when you start making tables in MYSQL?

Apologies for noob questions. I am only student.


Solution

  • For example if you have this two tables:
    SUPPLIER(CodS, NameS, DeptS);
    PRODUCT(CodP, CodS, NameP, Qta);
    Where the bold words rappresented the primary keys on the tables, you connected this tables through attribute CodS in PRODUCT.

    Example for creating table:

    CREATE TABLE SUPPLIER (
    CodS INT NOT NULL,
    NameS VARCHAR(20) NOT NULL,
    DeptS VARCHAR(20) NOT NULL,
    PRIMARY KEY(CodS) );

    CREATE TABLE PRODUCT (
    CodS INT NOT NULL,
    CodP INT NOT NULL,
    NameP VARCHAR(20) NOT NULL,
    Qta INT,
    PRIMARY KEY(CodS, CodP) );

    I hope I've been useful