6.SQL Server TCL Commands and Constraints

Опубликовано: 06 Июль 2026
на канале: Tech2BI
59
1

====================================================
TCL Commands in SQL
Transaction Control Language (TCL) commands you to manage SQL server transactions. The following are the commands in this category.

-- ROLL BACK COMMAND USED TO RESTORE THE DATABASE TP ITS LAST COMMITED STATE;
-- COMMIT I SUSED SAVE ANY TRANSACTION PERMANENTLY
-- SAVE TRAN THIS COMMAND USED TO SAVE THE TRANACTION SO THAT WE CAN ROLL THAT TRANSACTION TO THE POINT WHERE EVER NECESSARY;


======================================================
-- CONSTRAINTS (Constraints are used to specify rule for data in a tables, while creating the tables or alter the tables)

-- PRIMARY KEY , FORIENKEY, UNIQUE,NOT NULL,CHECK,DEFAULT

-- unique unique values are different values, and it allows one null values
-- NOT NULL , That colulmn cannot have a null values
-- PRIMARY KEY, PRIMARY KEY IS the unique identified it will allow unique values and not null values (once primary key created its automatically creates index on table
-- 1table has only 1 primarykey,primary key may be 1 column or combination of multilpe columns.
-- FORIEN KEY -- maintain relationships / prevent any actions against realtion ships
-- CHECK -- To satisfy the condition which ever we defined
-- DEFAULT -- default value for a column if no value specified.


#data #database #sqlserver ‪@Tech2BI‬ @#sqltutorial