-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsqlquery4.sql
More file actions
31 lines (24 loc) · 823 Bytes
/
Copy pathsqlquery4.sql
File metadata and controls
31 lines (24 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Problem Statement
Write Queries to:
1. Update the Age of Id 2 to 18.
2. Update the cash_balance of Muthu to 2000.
Note: These two are seperate queries.
Information about the table
Table BankAccount:
Id | Name | cash_balance | Age
1 | Ayush | 500 | 21
2 | - | 1000 | 18
4 | Muthu | - | 25
Note: Print the complete table BankAccount after these updation.
Solution:
UPDATE bankaccount SET age =18 WHERE id=4;
UPDATE bankaccount SET cash_balance =2000 WHERE id=4;
select * from bankaccount;
Output:
+----+--------+--------------+------+
| Id | Name | cash_balance | Age |
+----+--------+--------------+------+
| 1 | Ayush | 500 | 21 |
| 2 | Aniket | 1000 | NULL |
| 4 | Muthu | 2000 | 18 |
+----+--------+--------------+------+