10. Modify
We already know how to query, filter, order, add new data and delete. The only thing left is to change existing data. The reserved word for this task is UPDATE.
UPDATE [tabla] SET [columna] = [nuevo valor], [columna] = [nuevo valor], ... WHERE [condicion];
Let's change the customer with Id 10, named Eduardo, to indicate that he is now at a small company called Facebook.
UPDATE Customer SET Company = 'Facebook' WHERE CustomerId = 10;
Did he move to Valencia? We change the columns that are needed.
UPDATE Customer SET City = 'Valencia', State = 'Comunidad Valenciana', Country = 'Spain' WHERE CustomerId = 10;
Our boss wants to change all the countries that say USA to EEUU.
UPDATE Customer SET Country = 'EEUU' WHERE Country = 'USA';
Activity 1
We go back to using the Track table (song).
- Raise the price of all the songs from 0.99 to 2.99.
- Raise the price of all the songs from 1.99 to 4.99.
- Change the Composer (
Composer) toSaraforTrackIdnumber 2000. - Change the Composer (
Composer) toclasicofor all the songs that start with the nameConcerto.
This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.
Desafíos de programación atemporales y multiparadigmáticos
Te encuentras ante un librillo de actividades, divididas en 2 niveles de dificultad. Te enfrentarás a los casos más comunes que te puedes encontrar en pruebas técnicas o aprender conceptos elementales de programación.
Buy the bookWill you buy me a coffee?
This is how I keep writing without ads or paywalls.
Sure, it's on me!
Comments
There are no comments yet.