Posts

Showing posts from March 28, 2021

SQL command TCL

Image
  What is TCL? TCL is a Transaction control language.   It is the sublanguage of SQL in which different commands are used to manage the transactions in the database. A transaction is a logical unit of work consisting of one or more SQL statements that are guaranteed to be atomic with respect to recovery. The changes that are made by DML statements like Insert, Delete, Update are managed by the TCL commands. These commands are BEGIN, COMMIT, ROLLBACK, SAVEPOINT. These commands ensure the integrity of data by allowing the statements to be grouped together into logical transactions. COMMIT  Statement: Commit statement ends the transaction successfully, making the database changes that are done by the DML commands permanent. If we’ll not use the COMMIT command then the changes made by INSERT IN TO, UPDATE or DELETE commands will not be permanent and can be rolled back So for the permanent manipulation COMMIT command will be used.  A new transaction starts after COMMIT with the BEGIN TRANS

SQL Command DCL

Image
   DCL (Data Control Language) The data in the database is an important asset of any organization. It shouldn’t be provided to all the users instead each and every user should be provided access to the data according to some privileges and rights. All this should be done to secure the data from illegal access. DBMS (Database Management System) should provide the mechanism to ensure that only the authorized user can access the data. Each user is given appropriate access rights to specific data objects (tables and views). In SQL these privileges and access rights can be assigned by the commands. What is DCL? DCL is a Data Control Language that contains commands related to assigning user rights and privileges. These commands are Grant and Revoke commands. Grant command: Grant command is used to provide access rights on database objects to specific users. Normally Grant statement is used by the owner of the table to provide access to the other users. The user who creates the table u

SQL statements (Data Manipulation Language)

Image
  Writing SQL Commands: Before knowing what are DML commands have a glance at what are SQL commands and how to write these commands. well, Commands are the SQL statements that are written by following some syntax to extract data from the database mainly and later on perform some other operations to manage or retain the data according to constraint(rules) in the database. SQL statements consist of reserved words and User-defined words. Reserved words have some specific meanings and can be as it is. They must be spelled properly as required and can not be split across lines such as SELECT ,ALTER,UPDATE etc. User-defined words are created by the user (according to the syntax rule) and represent the name of various database objects such as table column Views etc. Although SQL is a free format language the statements can be made more readable by following these steps. Ø Each clause in a statement should begin on a new line. Ø Uppercase letters are used to represent Reserved word