11.7. Exercises

  1. If you try to delete a record from the Genre table that has matching records in the Review table, the DELETE statement fails. How is this possible?

  2. If you try to delete a record from the Review table that has its GenreId set to the Id of an existing genre in the Genre table, the DELETE statement succeeds. Why?

  3. Imagine you want to clean up your database and decide to delete all records from the Review table that have an Id of 100 or less. What does your SQL statement look like?

  4. Imagine you want to delete the genre with an ID of 4. But before you delete the genre, you want to reassign reviews assigned to this genre to another genre with an ID of 11. What SQL statements do you need to accomplish this?

Get Beginning ASP.NET 3.5: In C# and VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.