+ 1

Sql favourate place problem? Help me to solve this?! And correct my code

ALTER TABLE cities ADD AttractivePlace UPDATE cities SET AttractivePlace = 'Belem Tower' WHERE name='Lisbon' UPDATE cities SET AttractivePlace = 'Plaza Mayor' WHERE name='Madrid' UPDATE cities SET AttractivePlace = 'Eiffel Tower' WHERE name='Paris' SELECT * FROM cities;

21st Feb 2021, 5:16 PM
Dhanushkumar M S
Dhanushkumar M S - avatar
13 Respostas
+ 9
ALTER TABLE cities add AttractivePlace VARCHAR; UPDATE cities SET AttractivePlace = 'Belem Tower' WHERE name = 'Lisbon'; UPDATE cities SET AttractivePlace = 'Plaza Mayor' WHERE name = 'Madrid'; UPDATE cities SET AttractivePlace = 'Eiffel Tower' WHERE population = 2161000; SELECT * FROM cities; As above I have tried with different column to set it in capital as mentioned in task. But it isn't happened. Could someone please bother to intervene with the proper resolution plz.
2nd May 2021, 9:09 AM
Swapnil Kamdi
Swapnil Kamdi - avatar
+ 4
ALTER TABLE cities add AttractivePlace VARCHAR; UPDATE cities SET AttractivePlace = 'Belem Tower' WHERE name = 'Lisbon'; UPDATE cities SET AttractivePlace = 'Plaza Mayor' WHERE name = 'Madrid'; UPDATE cities SET AttractivePlace = 'Eiffel Tower' WHERE population = 2161000; SELECT * FROM cities;
18th Jun 2022, 1:19 PM
Rajesh Kumar
Rajesh Kumar - avatar
+ 3
ALTER TABLE cities ADD place varchar(20); update cities SET Place = 'Belem Tower' WHERE name='Lisbon'; update cities SET Place = 'Plaza Mayor' WHERE name='Madrid'; update cities SET Place = 'Eiffel Tower' WHERE name='Paris'; SELECT * FROM cities;
17th Mar 2023, 1:56 PM
Berhanu Tsehay
Berhanu Tsehay - avatar
+ 2
ALTER TABLE cities ADD AttractivePlace VARCHAR; UPDATE cities SET AttractivePlace = 'Belem Tower' WHERE name = 'Lisbon'; UPDATE cities SET AttractivePlace = 'Plaza Mayor' WHERE name = 'Madrid'; UPDATE cities SET AttractivePlace = 'Eiffel Tower' WHERE name = 'Paris'; SELECT * FROM cities
7th Jul 2021, 3:16 AM
è‘›ć€
è‘›ć€ - avatar
+ 2
Aa sorry about that . When we add new column and by using ALTER Let’s say we have need update all row Do we have to put UPDATE,SET,WHERE keyword for every row ?
10th Nov 2021, 12:56 AM
Uğur GöktaƟ
+ 1
ALTER TABLE cities ADD AttractivePlace varchar (128); UPDATE cities SET AttractivePlace = 'Belem Tower' WHERE name='Lisbon'; UPDATE cities SET AttractivePlace = 'Plaza Mayor' WHERE name='Madrid'; UPDATE cities SET AttractivePlace = 'Eiffel Tower' WHERE name='Paris'; SELECT * FROM cities;
14th Jul 2022, 5:03 PM
Priya Purwar
Priya Purwar - avatar
+ 1
ALTER TABLE cities add Place VARCHAR; UPDATE cities SET Place = 'Belem Tower' WHERE name = 'Lisbon'; UPDATE cities SET Place = 'Plaza Mayor' WHERE name = 'Madrid'; UPDATE cities SET Place = 'Eiffel Tower' WHERE population = 2161000; SELECT * FROM cities; This is the solution to that problem, Have a nice day.
19th Apr 2023, 11:48 AM
Anslem Joseph Tamba
Anslem Joseph Tamba - avatar
0
Let me try anyway thanq
25th Feb 2021, 8:49 AM
Dhanushkumar M S
Dhanushkumar M S - avatar
0
is there any way update multiple value without recurring update,where,set command ? just curioisity :)
9th Nov 2021, 4:32 PM
Uğur GöktaƟ
0
Please elaborate the question once! Uğur GöktaƟ
9th Nov 2021, 4:34 PM
Swapnil Kamdi
Swapnil Kamdi - avatar
0
Select *All and say "Hello" I would like to know if this exercice is incorrect because when we copy the solution it's still wrong I copied the answer of @Swapnil and it worked so could you tell me more about it please ? Thanks*
14th Jun 2023, 1:40 PM
TOURE Oumou
TOURE Oumou - avatar
0
I made a more effective way, in my case AttractivePlace is just place ALTER TABLE cities ADD place VARCHAR(128); UPDATE cities SET place = CASE WHEN name = 'Lisbon' THEN 'Belem Tower' WHEN name = 'Madrid' THEN 'Plaza Mayor' WHEN name = 'Paris' THEN 'Eiffel Tower' END ; SELECT * FROM cities;
20th Jun 2023, 4:33 AM
Gusti Andika Pratama
0
Here is the correct answer -- Add the new column to the table ALTER TABLE cities ADD COLUMN AttractivePlace VARCHAR(255); -- Update the new column with specific values for certain cities UPDATE cities SET AttractivePlace = 'Belem Tower' WHERE name = 'Lisbon'; UPDATE cities SET AttractivePlace= 'Plaza Mayor' WHERE name = 'Madrid'; UPDATE cities SET AttractivePlace= 'Eiffel Tower' WHERE name = 'Paris'; -- Select all records from the table to view the changes SELECT * FROM cities;
1st Jun 2024, 10:28 AM
Shivani Gujar
Shivani Gujar - avatar