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

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

The HTML over WebSockets approach simplifies single-page application (SPA) development and lets you bypass learning a JavaScript rendering framework such as React, Vue, or Angular, moving the logic to Python. This web application development book provides you with all the Django tools you need to simplify your developments with real-time results.

Buy the book

Help me keep writing

Every coffee gives me a push toward the next article.

Comments

There are no comments yet.