Define Data Definition Language?

       

    • DDL represents to Data Definition Language
    • It is used to define the Data Structures in SQL Servers
    • It is used to:
    • Create the Object
    • Edit the structure of the Object
    • Delete the Object
    •  

       

      FAQ:What is meant by Database Objects?

       

      • Tables
      • Views
      • Synonyms
      • Indexes
      • Stored Procedures
      • functions
      • Triggers

       

      State the differences between DROP Vs TRUNCATE

      Drop Table:

       

      • This is DDL Command
      • This is used to DROP Database objects like Tables,Views etc
      • Deletes an object in the database, permanently

       

      Q: Write a Query to drop “sales” table?

      Syntax: Drop table sales

       

      Truncate Table:

       

      • Removes all records from a table, including all spaces allocated for the records are removed
      • Releases the storage space used by that table
      • Rollback\Undo is not possible in case Truncate command

       

      Q: Write a Query to truncate “sales” table?

      Syntax:Truncate table sales

       

       

      State the differences between DROP Vs TRUNCATE

       

      Drop Vs Truncate
      Truncate
      Delete
      Truncate is a DDL command
      Delete is a DML Command.
      Condition doesn't exists in case of deletion
      It deletes rows on conditonal basis
      We can't use clauses
      We will use where clause
      Rollback not possible
      Rollback possible
      TRUNCATE deletes only all records
      DELETE can delete all or particular records

       

       

      In how many ways Data can be stored in Database?

       

      Data in SQL Server stores in 3 ways

       

    • Data Name
    • Data Type
    • Data Size
    •  

      State about the features of Data Name?

       

    • Data name also termed as Field name,Column Name
    • Minimum length of Data Name is 1 Character Maximum length is 127 Characters
    • For every column name in between spaces are not allowed [space is allowed within square brackets].
    •  

       

    • Column name must be user defined name
    •  

       

    • Every column name must be unique name(duplicates are not allowed in a table)
    • For every column name in between Special symbols are not allowed except under score_, hyphen’. These are forcefully allowed with in square brackets.[S@No]
    • Ex:

      Emp_Name

      Location_Name