CREATE FORIEGN KEY | SQL Tutorial and Query Example

Text copied!

CREATE FORIEGN KEY


  • FOREIGN KEY syntax in SQL
    CREATE TABLE child_table (
        column1 datatype,
        column2 datatype,
        ...
        foreign_key_column datatype,
        CONSTRAINT constraint_name
        FOREIGN KEY (foreign_key_column)
        REFERENCES parent_table (parent_column)
    );