Page 85 - CITS - Computer Software Application -TT
P. 85

COMPUTER SOFTWARE APPLICATION - CITS




           Triggers are essentially sets of statements that automatically execute in response to predefined events, providing
           a means to enforce more intricate data integrity rules when necessary.
           Example:-When a new row containing marks for various subjects of students is added to the student_table, an
           automatic calculation of the new average is performed and stored.
           SQL commands
           •  SQL commands are directives employed to interact with a database, facilitating the execution of particular
              actions, operations, and inquiries on data within the database.
           •  SQL has the capability to execute a range of functions, such as generating tables, inserting data into tables,
              deleting tables, altering table structures, and defining user permissions.

           Types of SQL Commands
           There are five types of SQL commands: DDL, DML, DCL, TCL, and DQL.





























           DDL (Data Definition Language)
           DDL, which stands for Data Definition Language, is a subset of SQL (Structured Query Language) used for
           defining and managing the structure of a database. DDL commands allow you to create, modify, and delete
           database objects like tables, indexes, and constraints. DDL is primarily concerned with defining the schema or
           structure of the database. Common DDL commands include:

           1  CREATE: Used to create new database objects such as tables, indexes, and views.
           CREATE TABLE table_name (
           column1 datatype,
           2  ALTER: Used to modify the structure of an existing database object, like adding or dropping columns from a
              table.
              ALTER TABLE table_name
              ADD column_name datatype;

              ALTER TABLE table_name
              DROP COLUMN column_name;
           3  DROP: Used to delete a database object like a table, index, or view.
              DROP TABLE table_name;
           4  TRUNCATE: Used to remove all rows from a table but keep the table structure intact.
              TRUNCATE TABLE table_name;



                                                           72

                              CITS : IT&ITES - Computer software application - Lesson 18 - 36
   80   81   82   83   84   85   86   87   88   89   90