USING UPDATE:
This can be used to modify the table data.
Syntax: Update <table_name> set <col1> =
value1, <col2> = value2 where <condition>;
Ex: update student set marks = 500;
(NOTE: If you are not specifying any
condition this will update entire table.)
Output:
NO
|
NAME
|
MARKS
|
1
|
Visu
|
500
|
2
|
Vasu
|
500
|
3
|
Manoj
|
500
|
4
|
Aisu
|
500
|
5
|
Mohan
|
500
|
6
|
Manvi
|
500
|
7
|
Namu
|
500
|
8
|
Susu
|
500
|
9
|
Thanu
|
500
|
10
|
AJ
|
500
|
11
|
MK
|
500
|
12
|
MD
|
500
|
EX: update student set marks = 500 where no = 2;
Output:
NO
|
NAME
|
MARKS
|
1
|
Visu
|
100
|
2
|
Vasu
|
500
|
3
|
Manoj
|
300
|
4
|
Aisu
|
400
|
5
|
Mohan
|
500
|
6
|
Manvi
|
600
|
7
|
Namu
|
500
|
8
|
Susu
|
300
|
9
|
Thanu
|
200
|
10
|
AJ
|
100
|
11
|
MK
|
(null)
|
12
|
MD
|
(null)
|
EX: update
student set marks = 500, name = 'Visu' where no = 1;
Output:
NO
|
NAME
|
MARKS
|
1
|
Visu
|
500
|
2
|
Vasu
|
500
|
3
|
Manoj
|
300
|
4
|
Aisu
|
400
|
5
|
Mohan
|
500
|
6
|
Manvi
|
600
|
7
|
Namu
|
500
|
8
|
Susu
|
300
|
9
|
Thanu
|
200
|
10
|
AJ
|
100
|
11
|
MK
|
(null)
|
12
|
MD
|
(null)
|
No comments:
Post a Comment