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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:09:44+00:00 2026-06-14T17:09:44+00:00

I have a table with 3 fields, one of them is status. status is

  • 0

I have a table with 3 fields, one of them is “status”.
status is an ENUM with possible content ‘a’, ‘b’ or ‘c’.

I need to find a way to deny any update on all rows having “status” = ‘b’ not even the root user should be allowed to update these rows. So its like making this row “final”.
Update should be allowed if status = a or status = c.

Is there any way to do this?
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-06-14T17:09:44+00:00Added an answer on June 14, 2026 at 5:09 pm

    You can use this trigger –

    DELIMITER $$
    
    CREATE TRIGGER trigger1
      BEFORE UPDATE
      ON table1
      FOR EACH ROW
    BEGIN
      IF OLD.status = 'b' THEN
        SIGNAL SQLSTATE '02000' SET MESSAGE_TEXT = 'Cannot update value';
      END IF;
    END
    $$
    
    DELIMITER ;
    

    If you know the bane of toot user and want to allow him to update, then you can use this condition –

    ...
    IF CURRENT_USER() <> 'root@localhost' AND OLD.status = 'b' THEN
      SIGNAL SQLSTATE '02000' SET MESSAGE_TEXT = 'Cannot update value';
    END IF;
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table with some fields, one of them, cost , is
I have table with several fields, one of them is Id auto-increment/primary field. Is
I have a table in MySql with several different fields, one of them contains
I have a table in database that is having some fields one of which
I have one table that has two fields - ID1 and ID2 ID1 can
I have a table in a django app where one of the fields is
I have a favorite table containing some fields like login_id,driver_id(One login_id may have many
I have one table, t1, which has fileds called userid, week and year fields.
I have a table, in one of the fields I stored a string like
I have a DB with many tables and one of the table has fields:

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.