UPDATE command is used to modify the the table data (Records) in SQL. UPDATE command used with SET Key word. For example if you have a table with some record and you want to make some changes in that records, then you can use UPDATE command with SET keyword. With UPDATE command you can also use the WHERE clause for make changes on some specific recode.
Syntax is :
UPDATE Table-Name
SET Coulm1=vlaue1 ,column2=value2......
WHERE Condition ;
For example we have a following table
TABLE_A
| Name | Course_Title | Contact No | City |
| Mr. Muneer | DIT | 999999 | NULL |
| Mr. Naweed | PDP | 222222 | NULL |
| Mr.tauqeer | DIT | 333333 | NULL |
| Mr. Jalil | DIT | 222222 | NULL |
In above table there is no city name is given in all record. if you want insert the same city name in each record then you can use the following statement:
UPDATE Table-A
SET City='Lahore' ;
The above statement set the city name Lahore of the all records.
if you want set a Unique city name of each record then you can use the following statement:
UPDATE Table-A
SET City='Lahore' ;
WHERE Name='Mr. Muneer' ;
The above statement set the city name Lahore only for Mr. Muneer.
Select Command
Distinct clause with Select Command
Where clause In SQL
Logical Operator in SQL SELECT Statement
IN Operator in SQL
BETWEEN Operator in SQL
Use of Wildcards in SQL
LIKE Operator in SQL
ORDER BY Clause in SQL
GROUP BY Clause in SQL
HAVING Clause in SQL
ALIAS In SQL
AS Keyword In SQL
INSERT INTO Command In SQL
Inserting Record In to a Table Form an other Table In SQL
UPDATE Command in SQL
DELETE Command in SQL
AVG Function in SQL