9. Delete

If we want to delete a row we must use the combination of words DELETE FROM + the name of the table + a filter.

DELETE FROM [tabla] WHERE [condicionales];

Let's delete a row from Playlist, the one called Audiobooks.

DELETE FROM Playlist WHERE Name = 'Audiobooks';

Or, if we want to be more specific, with its Id.

DELETE FROM Playlist WHERE PlaylistId = 6;

If you do not use WHERE, you will delete all the information in the table!

Activity 1

We go back to using the Artist table (song). (use PRAGMA foreign_keys = OFF to disable the check)

  • Delete U2.
  • Delete the artists that have the & symbol in their name.
  • Delete the artists with an Id between 201 and 230.
  • Delete the entire Track table.

Solutions

This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.

Desafíos de programación atemporales y multiparadigmáticos

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 book

Will you buy me a coffee?

This is how I keep writing without ads or paywalls.

Comments

There are no comments yet.