-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsqlquery13.sql
31 lines (28 loc) · 867 Bytes
/
sqlquery13.sql
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
Given the table cities, form a query using REPLACE, to update/add the given data:
Attribute | Updated value
id | 4
cname | Phoenix
population | 1768980
Information about the table
Table cities :
+------+----------+------------+
| id | cname | population |
+------+----------+------------+
| 1 | chicago | 2746388 |
| 2 | New York | 8483190 |
| 5 | LA | 3689867 |
+------+----------+------------+
Solution:
REPLACE INTO cities(id,cname,population)
VALUE(4,'Phoenix',1768980);
SELECT * FROM cities;
Ouput:
+------+----------+------------+
| id | cname | population |
+------+----------+------------+
| 1 | chicago | 2746388 |
| 2 | New York | 8483190 |
| 5 | LA | 3689867 |
| 4 | Phoenix | 1768980 |
+------+----------+------------+