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 180795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:38:56+00:00 2026-05-11T14:38:56+00:00

I have got a problem with two tables: CREATE TABLE IF NOT EXISTS `addresses`

  • 0

I have got a problem with two tables:

 CREATE TABLE IF NOT EXISTS `addresses` (    `adr_id` int(11) NOT NULL auto_increment,    `per_id` int(11) NOT NULL,    `adr_street` varchar(50) NOT NULL,    `adr_houseno` int(11) default NULL,    `adr_housenoadd` varchar(10) default NULL,    `adr_postalcode` varchar(25) NOT NULL,    `adr_city` varchar(20) NOT NULL,    `adr_type` varchar(45) default NULL,    `cnt_id` int(11) NOT NULL,    `adr_date` date default NULL,    `sys-mut-dt` timestamp NULL default NULL,    `sys-mut-user` varchar(20) default NULL,    `sys-mut-id` int(11) NOT NULL default '0',    PRIMARY KEY  (`adr_id`),    KEY `per_id` (`per_id`),    KEY `cnt_id` (`cnt_id`)  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;  --  -- RELATIES VOOR TABEL `addresses`:  --   `cnt_id`  --       `countries` -> `cnt_id`  --   `per_id`  --       `persons` -> `per_id`  --   CREATE TABLE `events` (    `evt_id` int(11) NOT NULL auto_increment,    `evt_name` varchar(50) NOT NULL,    `evt_description` varchar(100) default NULL,    `evt_startdate` date NOT NULL,    `evt_enddate` date default NULL,    `evt_starttime` time default NULL,    `evt_endtime` time default NULL,    `evt_amtpersons` int(11) default NULL,    `sts_id` int(11) NOT NULL,    `adr_id` int(11) default NULL,    `evt_amtPersonsSubs` tinyint(4) NOT NULL default '0',    `evt_photo` varchar(50) default NULL,    `sys-mut-dt` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,    `sys-mut-user` varchar(20) default NULL,    `sys-mut-id` int(11) NOT NULL default '0',    PRIMARY KEY  (`evt_id`),    KEY `sts_id` (`sts_id`),    KEY `adr_id` (`adr_id`)  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;  

The problem is, when i try to delete a record from address table I get the following error

DELETE FROM    addresses WHERE   per_id = 45  1451 - Cannot delete or update a parent row: a foreign key constraint fails (`site/events`, CONSTRAINT `adr_id` FOREIGN KEY (`adr_id`) REFERENCES `addresses` (`adr_id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ;  

The weird thing is that there is no record with the same per_id or adr_id in the events table.

So what’s going on over here?

How Can I solve this? 😉

/* I think it means 'How can I solve this?' */ 
  • 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. 2026-05-11T14:38:57+00:00Added an answer on May 11, 2026 at 2:38 pm

    It may sound stupid, but are you absolutely sure there are no child rows?

    Could you please run this:

    SELECT  e.* FROM    addresses a JOIN    events e ON      e.adr_id = a.adr_id WHERE   a.per_id = 45 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User
For example I have the following tables resulting from: CREATE TABLE A (Id int,
I have the following problem: I got a view with two text fields and
Got a problem with a query I'm trying to write. I have a table
I've got a problem I'm not sure how best to solve. I have an
I have a MySQL database with two tables (simplified for this question): movies table
I've got a table structure I'm not really certain of how to create the
ok the problem is that I have to sum two sums from two tables
I have got a problem with calling a global function, which takes a pointer
I have got the following problem since the server has safe mode turned on,

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.