Skip to content

Fatih Acar's blog

About of Database Systems and Information Technologies

Menu
  • Home
  • About Me
  • Contact Me
Menu

Delete row from table which have constraint column

Posted on 15/06/201115/06/2011 by Fatih Acar

You can use two method for this processing. You can either do disable constraint or use on delete cascade or on delete set null in table.

Method 1

Table Name : employees
Constraints : primary_key_employee_id , foreign_key_department_id

If you want to delete row from employees, you must disable foreign key constraint.

ALTER TABLE employees DISABLE CONSTRAINT foreign_key_department_id;

After, you can delete row from employees.If you want to make enable constraint, you can use bottom query.

ALTER TABLE employees ENABLE CONSTRAINT foreign_key_department_id;

Method 2

You must do table alter. You can use on delete cascade or on delete set null.
On Delete Cascade : Deletes the dependent rows in the child table when a row in the parent table is deleted.
On Delete Set Null : Converts the dependent foreign key values to null.

ALTER TABLE employees ON DELETE CASCADE;
ALTER TABLE employees ON DELETE SET NULL;

After, you can delete row from employees.

Share this:

  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

11 thoughts on “Delete row from table which have constraint column”

  1. Leslie says:
    19/03/2014 at 13:34

    Great goods from you, man. I’ve understand your stuff previous to and you are just too magnificent.
    I really like what you’ve acquired here, really like what you’re saying and the way in which
    you say it. You make it enjoyable and you still take care of to keep it wise.
    I can not wait to read far more from you. This is
    actually a terrific website.

    Reply
  2. Madge says:
    21/03/2014 at 18:08

    Hey there! I could have sworn I’ve been to
    this blog before but after checking through some of
    the post I realized it’s new to me. Anyhow, I’m definitely happy
    I found it and I’ll be book-marking and checking back often!

    Reply
  3. rea says:
    22/05/2014 at 14:40

    Hi, its fastidious paragraph on the topic of media
    print, we all understand mmedia is a wonderful source of facts.

    Reply
  4. Fernando says:
    17/06/2014 at 22:41

    Hi, its pleasant piece of writing regarding media print, we all know media is a fantastic source
    of information.

    Reply
  5. Harvey says:
    21/06/2014 at 10:10

    An intriguing discussion is definitely worth comment.
    I believe that you should publish more about this topic, it may not be
    a taboo subject but usually people don’t discuss these issues.
    To the next! Kind regards!!

    Reply
  6. najbrza dijeta says:
    19/08/2014 at 06:55

    I’ll immediately clutch you rss aas I cann not find your email subscription lknk or e-newsletter service.
    Do you have any? Please permit mee recognise so that I may just subscribe.
    Thanks.

    Reply
  7. erotska masaza tehnika says:
    26/08/2014 at 11:10

    Amazing issues here. I’m very glad to peer your
    post. Thank youu a llot and I’m looking ahead to touch you.
    Will you kindly drop me a e-mail?

    Reply
  8. chudnutie cvičenie says:
    29/08/2014 at 09:23

    Hi there, I wish for to subscribe for this web site to get latest updates, so
    where can i doo it please help.

    Reply
  9. 1881 says:
    29/08/2014 at 19:50

    Thanks for every other informative blog. Where else may I get that type off information written in such an ideal approach?
    I’ve a project that I aam simply now working on, and I have been at the glance out for such information.

    Reply
  10. law says:
    05/10/2014 at 23:10

    What’s up i am kavin, its my first time to commenting anywhere, when i read this piece of writing i thought i could also
    make comment due to this good post.

    Reply
  11. Business news says:
    02/07/2018 at 18:29

    This article is genuinely a good one it assists new internet visitors, who
    are wishing in favor of blogging.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.



View Fatih ACAR's profile on LinkedIn

Categories

  • Databases (329)
    • MsSQL Server (18)
      • Administration (16)
      • Errors and Solutions (4)
      • SQL (2)
    • MySQL (5)
      • Administration (4)
      • Backup And Recovery (1)
      • Errors and Solutions (1)
    • Oracle (290)
      • Administration (79)
      • Backup And Recovery (29)
      • Errors and Solutions (195)
      • Procedure (10)
      • SQL (32)
    • PostgreSQL (16)
      • Administration (15)
      • Errors and Solutions (3)
      • SQL (2)
    • Redis (1)
  • Microsotf Dynamics CRM (1)
  • Operating Systems (47)
    • Linux & Unix (34)
    • Windows (13)
  • Programing (5)
    • Python (5)
  • SAP (15)
    • Errors and Solutions (4)
    • SAP Basis (12)
  • Security (8)
    • Database Security (6)
    • Information Security (1)
    • System Security (4)
  • VMware (4)

Recent Posts

  • Redis 7 Sentinel Infrastructure Installation
  • Oracle Database 19c Multi Data Guard and DML Redirect, Switchover-Failover Operations on Oracle Linux 8
  • Oracle Database 23ai Free Installation Steps on Oracle Linux 9
  • Oracle Database 19c Active Data Guard Installation and DML Redirect, Switchover-Failover Operations on Oracle Linux 8
  • Oracle Database 19c Installation and 19.22 RU Patch Apply on Oracle Linux 8

Resources

  • Oracle
  • PostgreSQL

Blogroll

  • Gökhan Atıl
  • H. Koray Gündüz
  • Hakan Talip Öztürk
  • Zekeriya Beşiroğlu

Web Pages

  • BT Çözümleri

Tag Cloud

Administration Backup and Recovery Cluster Systems Database Administration Database Security Linux Linux Administration MsSQL Server MsSQL Server Error and Solutions MySQL MySQL Administration ORA-00018 ORA-00020 Oracle Oracle 12c Oracle 19c Oracle Administration Oracle Backup and Restore Oracle Data Guard Oracle Data Guard Failover Oracle Data Guard Switchover Oracle Error Solutions Oracle Linux Oracle Rman Backup Oracle Security Oracle SQL Query PostgreSQL PostgreSQL Administration PostgreSQL High Availability PostgreSQL Hot Standby Python SAP Basis Sap Errors and Solutions Sap System Administration SQL SQL Server Administration SQL Server Availability Group Stored Procedure System Administration System Security VMware VMware Administration Windows Windows Batch Script Windows Server

Social

  • View facar1987’s profile on Twitter
  • View facar’s profile on LinkedIn

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 17 other subscribers
©2026 Fatih Acar's blog | Built using WordPress and Responsive Blogily theme by Superb