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

  • Home
  • SEARCH
  • 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 417695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:36:20+00:00 2026-05-12T18:36:20+00:00

I am starting to experiment with using InnoDB in web applications. I’ve setup some

  • 0

I am starting to experiment with using InnoDB in web applications. I’ve setup some tables with a foreign key, but they are not behaving as expected.
Here are my table CREATE statements:

CREATE TABLE sections ( 
    section_id  INT NOT NULL AUTO_INCREMENT, 
    title       VARCHAR(30), 
    created_at  int(10) NOT NULL, 
    updated_at  int(10) NOT NULL,

    PRIMARY KEY(section_id)
) ENGINE=InnoDB; 

CREATE TABLE pages ( 
    page_id       INT NOT NULL AUTO_INCREMENT, 
    section_idfk  INT NOT NULL, 

    PRIMARY KEY(page_id), 
    FOREIGN KEY(section_idfk) REFERENCES sections(section_id) 
    ON DELETE CASCADE 
    ON UPDATE CASCADE
) ENGINE=InnoDB;

The tables create ok and I can populate them with data, however, I was expecting any changes I made to the Sections table to have an effect on the corresponding rows in the Pages table. I tried changing the ID of a section and also deleting a section entirely. In both cases, the Pages table was unaffected.

Can anyone see where I’m going wrong?

Any advice appreciated.
Thanks.

  • 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-12T18:36:20+00:00Added an answer on May 12, 2026 at 6:36 pm

    I quickly put together two similar tables in the MySQL Query Browser with the following definitions:

    DROP TABLE IF EXISTS `test`.`sections`;
    CREATE TABLE  `test`.`sections` (
      `section_id` int(10) unsigned NOT NULL auto_increment,
      `title` varchar(30) NOT NULL,
      `created_at` int(10) unsigned NOT NULL,
      `updated_at` int(10) unsigned NOT NULL,
      PRIMARY KEY  (`section_id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
    
    DROP TABLE IF EXISTS `test`.`pages`;
    CREATE TABLE  `test`.`pages` (
      `page_id` int(10) unsigned NOT NULL auto_increment,
      `section_idfk` int(10) unsigned NOT NULL,
      PRIMARY KEY  (`page_id`),
      KEY `section_idfk` (`section_idfk`),
      CONSTRAINT `section_idfk` FOREIGN KEY (`section_idfk`) REFERENCES `sections` (`section_id`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
    

    Not exactly the same as the ones you posted, but close enough.

    I insert into sections a row.
    I add a row with a matching section_id into the pages table.
    Then I do a DELETE FROM sections; and it deletes from pages as well.

    Works just fine.

    edit – I entered your creates and it works fine too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer $('.viewuser').dialog('close'); May 16, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer I pasted the contents of your example into a file… May 16, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer arguments are packed in tuple (a,b) and passed to functors.… May 16, 2026 at 10:05 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm starting to experiment with using ActiveMQ (in conjunction with the ActiveMQ.NMS bindings) to
I'm starting to experiment with CouchDB because it looks like the perfect solution for
I've developed a simple webflow in Grails (mostly to experiment with using webflows- its
Starting with MVC2, messing around with a simple db and just using the index
Starting with some code: sessionFactory = Fluently.Configure(cfg) .Mappings(m => { List<Assembly> allAssemblies = new
Just starting to explore the 'wonders' of regex. Being someone who learns from trial
I'm working on a sort of a CMS/Wiki application to help me experiment with
I'm starting a experimental project and I was looking for advice to choose the
Starting with an array with 10K values. I want to randomly get 1000 values
Starting with Ant 1.7, the TarFileSet is available which seems to allow file permission

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.