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 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

Ask A Question

Stats

  • Questions 116k
  • Answers 116k
  • 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 It would appear you've tried to filter based on a… May 11, 2026 at 10:40 pm
  • Editorial Team
    Editorial Team added an answer The first version means you can examine foo in a… May 11, 2026 at 10:40 pm
  • Editorial Team
    Editorial Team added an answer Namespace depth should correlate to frequency of usage. Why not… May 11, 2026 at 10:40 pm

Related Questions

Let's assume that I have two tables... Foo and Bar. They contain the following
Ok, I have two tables that I am joining and doing a select on
Let's say I have two existing tables, dogs and cats: dog_name | owner ---------+------
I have two tables in my SQL database: Company: ID (autoincrement) name address ...

Trending Tags

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

Top Members

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.