Delete a category but keep the articles
On a blog an article may have a category. When an editor deletes an outdated category, the articles must not be lost — let their category reference become empty, but keep the text.
Build a categories table with a single field id (primary key) and an articles table with id (primary key) and a category_id column referencing categories(id). Configure the relationship so that when a category is deleted, the category_id of its articles automatically becomes null while the articles themselves stay.
Just CREATE/ALTER/DROP — no trailing SELECT needed.
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inNo starting schema
This task starts with no tables — you'll create them via CREATE TABLE.