Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 720097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:43:10+00:00 2026-05-14T05:43:10+00:00

I’ve been trying to get a delete to cascade and it just doesn’t seem

  • 0

I’ve been trying to get a delete to cascade and it just doesn’t seem to work. I’m sure I am missing something obvious, can anyone help me find it?

I would expect a delete on the ‘articles’ table to trigger a delete on the corresponding rows in the ‘article_section_lt’ table.

CREATE TABLE articles (
    id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,
    url_stub VARCHAR(255) NOT NULL UNIQUE,
    h1 VARCHAR(60) NOT NULL UNIQUE,
    title VARCHAR(60) NOT NULL,
    description VARCHAR(150) NOT NULL,
    summary VARCHAR(150) NOT NULL DEFAULT "",
    html_content TEXT,
    date DATE NOT NULL,
    updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)ENGINE=INNODB;


CREATE TABLE article_sections (
    /* blog, news etc */
    id INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,
    url_stub VARCHAR(255) NOT NULL UNIQUE,
    h1 VARCHAR(60) NOT NULL,
    title VARCHAR(60) NOT NULL,
    description VARCHAR(150) NOT NULL,
    summary VARCHAR(150) NOT NULL DEFAULT "",
    html_content TEXT NOT NULL DEFAULT ""
)ENGINE=INNODB;

CREATE TABLE article_section_lt (
    fk_article_id INTEGER UNSIGNED NOT NULL REFERENCES articles(id) ON DELETE CASCADE,
    fk_article_section_id INTEGER UNSIGNED NOT NULL
)ENGINE=INNODB;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:43:11+00:00Added an answer on May 14, 2026 at 5:43 am

    You need to explicitly declare the foreign key constraint. The REFERENCES clause on a column definition doesn’t work.

    Try this:

    CREATE TABLE article_section_lt (
        fk_article_id INTEGER UNSIGNED NOT NULL,
        fk_article_section_id INTEGER UNSIGNED NOT NULL,
        KEY fk_article_id (fk_article_id),
        CONSTRAINT fk_article_section_lt_to_article FOREIGN KEY (fk_article_id) REFERENCES articles(id) ON DELETE CASCADE
    )ENGINE=INNODB;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.