Page 484 - Computer_Science_F5
P. 484

Data Control Language (DCL) command
              It is used to control  users’ rights in accessing  data  in the database.  It uses two
              controls, GRANT and REVOKE.

              (a) GRANT
          FOR ONLINE READING ONLY
              It is used to give users access privileges to a database. The syntax is GRANT privilege  Chapter Eight: Databases and Database Management Systems
              [, privilege], ON privilege_ level TO account_name; For example, If you need to
              give user_M access to the database student, the query will be:
                GRANT ALL ON
                student
                TO user_M;


              (b) REVOKE
              It is used to revoke access permissions that were previously granted to prevent a user
              from accessing the database objects. The syntax is REVOKE privilege_name ON
              object_name FROM {user_name |PUBLIC |role_name}

              For example: If you need to remove user_M from accessing the database student,
              the query will be:

                REVOKE ALL
                ON student
                FROM user_M;


              Transaction Control Language (TCL) command
              Transaction Control Language command is used to handle database transactions.
              It keeps track of the modifications made by the data manipulation language. It also
              enables the grouping of statements into logical transactions. The transaction control
              language consists of COMMIT, ROLLBACK, and SAVEPOINT.


              (a) COMMIT
              COMMIT command is used to save any transaction into the database permanently.
              When we use any DML command like INSERT, UPDATE or DELETE, the changes
              made by these commands are not permanent; until the current session is closed, the
              changes made by these commands can be rolled back. To avoid that, we use the
              COMMIT command to mark the changes as permanent. The syntax is COMMIT;
                 Example:
                 Delete from student_registration
                 Where address = 250 Dodoma;

                 Commit;

                                                    475
               Student’s Book  Form Five



     Computer Science Form 5.indd   475                                                     23/07/2024   12:35
   479   480   481   482   483   484   485   486   487   488   489