• Breaking News

    Create a table & adding constraints


    The CREATE TABLE statement is used to create a new table in a database.
    and adding constraint mean to limit the type of data that can go into a table.

    Syntax:
    CREATE TABLE table_name (
    column1 datatype,
    column2 datatype,
    column3 datatype,
    ….);

    For constraint:
    CREATE TABLE table_name (
    column1 datatype constraint constraint_name constraint type
    column2 datatype constraint constraint_name  references  table_name(column_name of  primary key)
    ….
    );





    In this deptid was primary key in employee table and it is used as foreign key in department table

    No comments