SlideShare una empresa de Scribd logo
1 de 13
STRUCTURED QUERY
LANGUAGE
CONSTRAINTS, COMMIT AND ROLLBACK
CONSTRAINTS
Constraints are the rules which ensures the validity of data which is being
entered into the table.
CONSTRAIN
T
PURPOSE
PRIMARY
KEY
Sets a column or a group of columns as the Primary
Key of a table. Therefore, NULLs and Duplicate values
in this
column are not accepted.
NOT NULL Makes sure that NULLs are not accepted in the
specified column.
PRIMARY KEY CONSTRAINT
This constraint can be added at the time of creating a table:
Using Create Table Command:
Q. Create a table item having fields item no, name, price, quantity with item no as the Primary key.
Ans. Create table item ( itemno integer primary key, name char(20), price decimal(5,2), quantity integer);
OR
Create table item ( itemno integer , name char(20), price float(5,2), quantity integer, itemno primary key);
Q. Create a table item having fields item no, name, price, quantity with item no and name together as the
Primary key.
Ans. Create table item ( itemno integer , name char(20), price float(5,2), quantity integer, primary key(itemno,
name));
Note: Alter table command can also be used to add primary key constraint if the table is already created and we forgot to add this constraint at
the time of creating a table. This is discussed further in this presentation.
NOT NULL CONSTRAINT
NULL constraint when added to a column does not allow that particular column to
accept NULL values.
Q. Create a table item having fields item no, name, price, quantity with item no as the
Primary key and price should be NOT NULL.
Ans. Create table item ( itemno integer primary key, name char(20), price decimal(5,2)
NOT NULL, quantity integer);
VIEWING CONSTRAINT
DESC command is used to view the entire structure of the table along with the
constraints associated with its columns.
Q. WAC to display the structure of the table emp along with its constraints.
Ans. Desc item;
ADD, MODIFY AND REMOVE CONSTRAINTS
ALTER TABLE command is used to add, modify and delete constraint.
Q. WAC to add constraint PRIMARY KEY to the column item number of the table item;
Ans. Alter table item add primary key (itemno);
Q. WAC to make item number and name as the PRIMARY KEY of the table item.
Ans. Alter table item add primary key (itemno, name);
Q. WAC to delete the primary key constraint from the table item.
Ans. Alter table item drop primary key;
ADD, MODIFY AND REMOVE CONSTRAINT Contd….
The NOT NULL constraint can be added and removed by using MODIFY option of the
ALTER TABLE command.
Q. WAC to add a NOT NULL constraint to price column of the table item.
Ans. Alter table item modify price decimal(5,2) not NULL;
Q. WAC to remove a NOT NULL constraint from price column of the table item.
Ans. Alter table item modify price decimal(5,2) NULL;
ADVANCED RDBMS CONCEPTS
TRANSACTION: A transaction is a unit of work that must be done in logical
order and successfully as a group.
The statements which help to manage transaction are:
START TRANSACTION statement
COMMIT statement
ROLLBACK statement
START TRANSACTION
START TRANSACTION statement commits the current transaction and
starts a new transaction. It tells MySQL that the new transaction is
beginning and the statements that follow should be treated as a unit,
until this transaction ends.
SYNTAX:
START TRANSACTION;
Note: Start transaction statement does not take any clauses.
COMMIT
The COMMIT statement is used to save all changes made to the database during the
transaction to the database. Commit statement is issued at a time when the transaction is
Complete ie all the changes made to the database have been successful and the changes
should be saved to the database. COMMIT ends the current transaction.
SYNTAX:
COMMIT;
OR
COMMIT WORK;
Here WORK is a keyword and is optional.
INSERTING SAVEPOINT
The SAVEPOINT statement defines a book mark in a transaction. These book marks are useful in
rolling back a transaction till the book mark.
SYNTAX:
SAVEPOINT <savepoint name>;
Example:
SAVEPOINT Mark1;
In the above statement a save point with the name Mark1 is defined. It becomes a bookmark in
the transaction. Now the following statement will rollback the transaction till the bookmark named
Mark1.
AUTO COMMIT
 By default, Autocommit mode is on in MySQL. It means that MySQL does a COMMIT after
every SQL statement that does not return an error.
 When Autocommit is off then we have to issue COMMIT statement explicitly to save
changes made to the database.
 The following statement sets the autocommit mode to off. It also starts a new transaction
SET AUTOCOMMIT=0;
 The following statement sets the autocommit mode to ON. It also commits and terminates
the current transaction.
SET AUTOCOMMIT=1;
EXAMPLE
 mysql> SET AUTOCOMMIT = 0;
 mysql> INSERT INTO ITEM VALUES(103,'COFFEE TABLE',340);
 mysql> SELECT * FROM ITEM;
 mysql> ROLLBACK;
 mysql> SELECT * FROM ITEM;
 mysql> START TRANSACTION;
 mysql> UPDATE ITEM SET IPRICE = IPRICE +200;
 mysql> SAVEPOINT S1;
 mysql> UPDATE ITEM SET IPRICE = IPRICE +400;
 mysql> SELECT * FROM ITEM;
 mysql> ROLLBACK TO S1;
 mysql> SELECT * FROM ITEM;
 Mysql>SET AUTOCOMMIT ON;
 MYSQL> DELETE FROM ITEM WHERE IPRICE<200;
 Mysql> rollback;
Inserts a new record in the table item
Auto commit is disabled/off
Rolls back(undo) the insert command
Start transaction sets Auto commit off.
Increase the item price by Rs 200
Increase the item price by Rs 400
Sets the save point S1
Increase the item price by Rs 400, command will
be roll backed
Auto commit is set to on
Records with price>200 are deleted
Rollback cannot be done as auto commit
is on

Más contenido relacionado

La actualidad más candente

T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
KathiK58
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
SANTOSH RATH
 
Sql insert statement
Sql insert statementSql insert statement
Sql insert statement
Vivek Singh
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
OpenSourceIndia
 

La actualidad más candente (20)

Les03 Single Row Function
Les03 Single Row FunctionLes03 Single Row Function
Les03 Single Row Function
 
T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek SharmaIntroduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
 
Les11
Les11Les11
Les11
 
Sql insert statement
Sql insert statementSql insert statement
Sql insert statement
 
Interacting with Oracle Database
Interacting with Oracle DatabaseInteracting with Oracle Database
Interacting with Oracle Database
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
 
Les02
Les02Les02
Les02
 
Structured query language(sql)
Structured query language(sql)Structured query language(sql)
Structured query language(sql)
 
Alter table command
Alter table commandAlter table command
Alter table command
 
Sql functions
Sql functionsSql functions
Sql functions
 
Aggregate Functions,Final
Aggregate Functions,FinalAggregate Functions,Final
Aggregate Functions,Final
 
Les09 Manipulating Data
Les09 Manipulating DataLes09 Manipulating Data
Les09 Manipulating Data
 
Les10 Creating And Managing Tables
Les10 Creating And Managing TablesLes10 Creating And Managing Tables
Les10 Creating And Managing Tables
 
Les01 Writing Basic Sql Statements
Les01 Writing Basic Sql StatementsLes01 Writing Basic Sql Statements
Les01 Writing Basic Sql Statements
 
Built-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsBuilt-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric Functions
 
Clauses
ClausesClauses
Clauses
 
Les17
Les17Les17
Les17
 
Oracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guideOracle Sql & PLSQL Complete guide
Oracle Sql & PLSQL Complete guide
 

Destacado

Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3
Shaili Choudhary
 
Data Structure
Data StructureData Structure
Data Structure
sheraz1
 

Destacado (20)

SQL
SQLSQL
SQL
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1
 
Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
 
Pp
PpPp
Pp
 
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. PatilDiscrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
Discrete Mathematics S. Lipschutz, M. Lipson And V. H. Patil
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Working with Cookies in NodeJS
Working with Cookies in NodeJSWorking with Cookies in NodeJS
Working with Cookies in NodeJS
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
 
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Data Structure
Data StructureData Structure
Data Structure
 
Data file handling in c++
Data file handling in c++Data file handling in c++
Data file handling in c++
 
10. Search Tree - Data Structures using C++ by Varsha Patil
10. Search Tree - Data Structures using C++ by Varsha Patil10. Search Tree - Data Structures using C++ by Varsha Patil
10. Search Tree - Data Structures using C++ by Varsha Patil
 
Stacks in algorithems & data structure
Stacks in algorithems & data structureStacks in algorithems & data structure
Stacks in algorithems & data structure
 
stacks in algorithems and data structure
stacks in algorithems and data structurestacks in algorithems and data structure
stacks in algorithems and data structure
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Queues in C++
Queues in C++Queues in C++
Queues in C++
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 

Similar a Structured query language constraints (20)

Intro to tsql unit 9
Intro to tsql   unit 9Intro to tsql   unit 9
Intro to tsql unit 9
 
Ms sql server ii
Ms sql server  iiMs sql server  ii
Ms sql server ii
 
Sql modifying data - MYSQL part I
Sql modifying data - MYSQL part ISql modifying data - MYSQL part I
Sql modifying data - MYSQL part I
 
Les08
Les08Les08
Les08
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
 
Les08
Les08Les08
Les08
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Data integrity
Data integrityData integrity
Data integrity
 
Sql dml & tcl 2
Sql   dml & tcl 2Sql   dml & tcl 2
Sql dml & tcl 2
 
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
 
Crosstab query techniques
Crosstab query techniquesCrosstab query techniques
Crosstab query techniques
 
dbms lab manual
dbms lab manualdbms lab manual
dbms lab manual
 
dbms.pdf
dbms.pdfdbms.pdf
dbms.pdf
 
Manipulating data
Manipulating dataManipulating data
Manipulating data
 
Group-2.pdf
Group-2.pdfGroup-2.pdf
Group-2.pdf
 
SQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint PresentationSQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint Presentation
 
Les02
Les02Les02
Les02
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Structured query language constraints

  • 2. CONSTRAINTS Constraints are the rules which ensures the validity of data which is being entered into the table. CONSTRAIN T PURPOSE PRIMARY KEY Sets a column or a group of columns as the Primary Key of a table. Therefore, NULLs and Duplicate values in this column are not accepted. NOT NULL Makes sure that NULLs are not accepted in the specified column.
  • 3. PRIMARY KEY CONSTRAINT This constraint can be added at the time of creating a table: Using Create Table Command: Q. Create a table item having fields item no, name, price, quantity with item no as the Primary key. Ans. Create table item ( itemno integer primary key, name char(20), price decimal(5,2), quantity integer); OR Create table item ( itemno integer , name char(20), price float(5,2), quantity integer, itemno primary key); Q. Create a table item having fields item no, name, price, quantity with item no and name together as the Primary key. Ans. Create table item ( itemno integer , name char(20), price float(5,2), quantity integer, primary key(itemno, name)); Note: Alter table command can also be used to add primary key constraint if the table is already created and we forgot to add this constraint at the time of creating a table. This is discussed further in this presentation.
  • 4. NOT NULL CONSTRAINT NULL constraint when added to a column does not allow that particular column to accept NULL values. Q. Create a table item having fields item no, name, price, quantity with item no as the Primary key and price should be NOT NULL. Ans. Create table item ( itemno integer primary key, name char(20), price decimal(5,2) NOT NULL, quantity integer);
  • 5. VIEWING CONSTRAINT DESC command is used to view the entire structure of the table along with the constraints associated with its columns. Q. WAC to display the structure of the table emp along with its constraints. Ans. Desc item;
  • 6. ADD, MODIFY AND REMOVE CONSTRAINTS ALTER TABLE command is used to add, modify and delete constraint. Q. WAC to add constraint PRIMARY KEY to the column item number of the table item; Ans. Alter table item add primary key (itemno); Q. WAC to make item number and name as the PRIMARY KEY of the table item. Ans. Alter table item add primary key (itemno, name); Q. WAC to delete the primary key constraint from the table item. Ans. Alter table item drop primary key;
  • 7. ADD, MODIFY AND REMOVE CONSTRAINT Contd…. The NOT NULL constraint can be added and removed by using MODIFY option of the ALTER TABLE command. Q. WAC to add a NOT NULL constraint to price column of the table item. Ans. Alter table item modify price decimal(5,2) not NULL; Q. WAC to remove a NOT NULL constraint from price column of the table item. Ans. Alter table item modify price decimal(5,2) NULL;
  • 8. ADVANCED RDBMS CONCEPTS TRANSACTION: A transaction is a unit of work that must be done in logical order and successfully as a group. The statements which help to manage transaction are: START TRANSACTION statement COMMIT statement ROLLBACK statement
  • 9. START TRANSACTION START TRANSACTION statement commits the current transaction and starts a new transaction. It tells MySQL that the new transaction is beginning and the statements that follow should be treated as a unit, until this transaction ends. SYNTAX: START TRANSACTION; Note: Start transaction statement does not take any clauses.
  • 10. COMMIT The COMMIT statement is used to save all changes made to the database during the transaction to the database. Commit statement is issued at a time when the transaction is Complete ie all the changes made to the database have been successful and the changes should be saved to the database. COMMIT ends the current transaction. SYNTAX: COMMIT; OR COMMIT WORK; Here WORK is a keyword and is optional.
  • 11. INSERTING SAVEPOINT The SAVEPOINT statement defines a book mark in a transaction. These book marks are useful in rolling back a transaction till the book mark. SYNTAX: SAVEPOINT <savepoint name>; Example: SAVEPOINT Mark1; In the above statement a save point with the name Mark1 is defined. It becomes a bookmark in the transaction. Now the following statement will rollback the transaction till the bookmark named Mark1.
  • 12. AUTO COMMIT  By default, Autocommit mode is on in MySQL. It means that MySQL does a COMMIT after every SQL statement that does not return an error.  When Autocommit is off then we have to issue COMMIT statement explicitly to save changes made to the database.  The following statement sets the autocommit mode to off. It also starts a new transaction SET AUTOCOMMIT=0;  The following statement sets the autocommit mode to ON. It also commits and terminates the current transaction. SET AUTOCOMMIT=1;
  • 13. EXAMPLE  mysql> SET AUTOCOMMIT = 0;  mysql> INSERT INTO ITEM VALUES(103,'COFFEE TABLE',340);  mysql> SELECT * FROM ITEM;  mysql> ROLLBACK;  mysql> SELECT * FROM ITEM;  mysql> START TRANSACTION;  mysql> UPDATE ITEM SET IPRICE = IPRICE +200;  mysql> SAVEPOINT S1;  mysql> UPDATE ITEM SET IPRICE = IPRICE +400;  mysql> SELECT * FROM ITEM;  mysql> ROLLBACK TO S1;  mysql> SELECT * FROM ITEM;  Mysql>SET AUTOCOMMIT ON;  MYSQL> DELETE FROM ITEM WHERE IPRICE<200;  Mysql> rollback; Inserts a new record in the table item Auto commit is disabled/off Rolls back(undo) the insert command Start transaction sets Auto commit off. Increase the item price by Rs 200 Increase the item price by Rs 400 Sets the save point S1 Increase the item price by Rs 400, command will be roll backed Auto commit is set to on Records with price>200 are deleted Rollback cannot be done as auto commit is on