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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:16:03+00:00 2026-06-04T21:16:03+00:00

I have two tables: Requests – Request_id , Request_Message; // contains Requests Responses –

  • 0

I have two tables:

Requests – Request_id , Request_Message; // contains Requests

Responses – Response_id , Request_id , Response_Message; // Contains Responses for the request..
Request_id is foreign key for this table

Now while i am running the query delete from requests where Request_id = “REQ001”;.... if there is no corresponding response in responses table then query is working fine, other its giving foreign key constraint error.

I want while i delete any request from requests table all its corresponding responses must delete automatically from response table.. How to achieve this??

Thanks for your time..

Devesh

  • 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-06-04T21:16:04+00:00Added an answer on June 4, 2026 at 9:16 pm

    Using CASCADE in the definition of the FOREIGN KEY constraint is an option. However, I recommend using the multiple-table syntax of the delete statement, e.g.:

    DELETE FROM Requests, Responses
    USING Requests
    LEFT JOIN Responses ON Requests.Request_id=Responses.Request_id
    WHERE Requests.Request_id='REQ001';
    

    This is my preferred solution because it makes more explicit what actually happens.

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

Sidebar

Related Questions

I have two tables requests - request_id, request_message, user_id responses - response_id, request_id, response_message,
I have two tables called A and B . Table A contains request details
I have two tables. The first table is Requests and it looks like this
So I have two tables: Requests -------- Id RequestSchemeId ReceivedByUserId ForwardedRequests ----------------- Id RequestId
I have two tables. tbl_Request(PKRequestID, RequestCode) and tbl_Personnel(PKPersonID, PerosnelName FKRequestID) FKrfequestID is a foreign
I have two tables in APEX that are linked by their primary key. One
I have two tables. Table A: Contains a list of songs, song artwork, mp3
I have two tables in my database Requests and Balance tracker which has no
I have two tables in my database named...Requests and Balance tracker which has no
I have two tables in my database named...Requests and Balance tracker which has no

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.