Safcode Institute by Sir Safder





  • Data Definition Language

    In SQL, data definition language (DDL) is use for
    creating and modifying database and its objects like
    tables, indexes, and users. In Data Definition Language
    include ( Create, Alter, Drop ) Commands.
    
    Creating Database:
    create database safcode
    
    Creating Table:
    Syntax:
    create table table_name (
        column1 datatype, 
        column2 datatype,
        column3 datatype,
       ....
    )
    //like int, varchar, date etc
    
    Example:
    create table courses (
        courseid int,
        coursename varchar(50),
        duration varchar(50),
        fee int
    )
    
    Alter Table:
    If you want to add, remove or modify your columns in
    an existing table so you can use alter command.
    
    add addmission_date columns in a existing table.
    
    Example:
    alter table courses
    add addmision_date varchar(50)
    
    Delete Column:
    alter table courses
    drop column addmision_date
    
    Modify Column:
    alter table courses
    alter column addmision_date date
    
    DROP Command:
    drop table table_name/database_name
    
    Example:
    drop table courses
    
    The below SQL Server tutorial will help you to learn
    this DDL all Commands



  • You Can Also Watch Our Tutorial