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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:01:33+00:00 2026-05-13T10:01:33+00:00

I don’t have the (expensive) SQL standard at hand; what are updatable queries in

  • 0

I don’t have the (expensive) SQL standard at hand; what are updatable queries in SQL core/foundation?

I see that PostgreSQL doesn’t support them, but some other databases do; can you point me to the documentation on how they work in those databases?

PostgreSQL has query rewriting and updatable views with the rule system; is this very different?

  • 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-05-13T10:01:33+00:00Added an answer on May 13, 2026 at 10:01 am

    I just found this Oracle example on Wikipedia that looks like a SELECT in the left-hand side of an update:

    UPDATE (
    SELECT *
      FROM articles  
      JOIN classification c 
        ON a.articleID = c.articleID 
    ) AS a
    SET a.[updated_column] = updatevalue
    WHERE c.classID = 1
    

    Whereas most databases need the query to be written as:

    UPDATE a
    SET a.[updated_column] = updatevalue
    FROM articles a 
    JOIN classification c 
    ON a.articleID = c.articleID 
    WHERE c.classID = 1
    

    Links: The oracle reference docs, examples.

    Do other databases support this? Where is it documented?


    Having now laid my grubby mittens on the standard, I’ll just quote it.

    E153 refers to:

    Subclause 7.12, “<query
    expression>”: A <query expression> is
    updatable even though its <where
    clause> contains a <subquery>

    Since a query expressions is also a table (not intuitive but it’s in SQL99 4.16.3 Operations involving tables), it means the query expression is an “udpatable table”. Which according to 4.16 means I can INSERT into and DELETE from them.

    Which means I can run the above, as well as:

    DELETE FROM (SELECT * FROM t1 JOIN t2 WHERE t1c1 = t2c3);
    

    There are some more rules to determine what query expressions are updatable, contained in sql99-foundation 7.11 and 7.12; they are rather involved. PostgreSQL doesn’t let query expressions that aren’t table names be updatable. There is some work being done on updatable views. I’m not sure how useful the feature is outside of views, but the standard is definitely interesting, and weirder than expected.

    [It’s feeling lonely here. Picking my answer as best.]

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

Sidebar

Related Questions

DON'T ASK WHY but... I have a regex that needs to be case insensitive
Don't yell at me! i have seen many threads claiming that HTML cannot be
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't think that I'm mad, I understand how php works! That being said. I
Don't they both have to convert to machine code at some point to execute
Don't overthink this - there's a very commonly used term and I ... have
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't think my virtualhost is working correctly. This is what I have inside of
Don't ask why but I have the requirement to draw a border around certain
Don't know what to do with this error. How to add data in SQL

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.