Modifying Record in a Table
☞ Following are the topics to be covered :
1. Modifying single record.
2. Modifying multiple records.
3. Modifying record to NULL value.
4. Modifying single record using an expression or formula.
5. Modifying multiple record using an expression or formula.
☞ To modify record into a table in RDBMS, we use UPDATE command.
☞ It is used to update the record(s).
☞ WHERE clause is used to update the number of records.
☞ Syntax :
UPDATE <table_name>
SET <column1> = <value1>, <column2> = <value2>,....
WHERE <condition>;
Modifying single record in a table
☞ Example :
UPDATE student
SET dob='2012-05-11', fees=10040.75
WHERE Rollno=3;
Modifying multiple records in a table
☞ Example :
UPDATE student
SET fees=15000
WHERE gender='M';
OR
UPDATE student
SET fees=15000;
Modifying record to NULL value in a table
☞ Example :
UPDATE student
SET dob=NULL
WHERE Rollno=3;
Modifying single record using an expression or formula in a table
☞ Example :
UPDATE student
SET fees=fees + 1000
WHERE Rollno=5;
Modifying multiple record using an expression or formula in a table
☞ Example :
UPDATE student
SET fees=fees+1000;