You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the VALUES clause is only used to supply constant data, we need to replace it with a query instead. The SELECT statement is fairly simple: there's an inner subquery that works out the next facid based on the largest current id, and the rest is just constant data. The output of the statement is a row that we insert into the facilities table.
However, a solution with VALUES is accepted by the web application:
Syntactically, VALUES followed by expression lists is treated as equivalent to:
SELECT select_list FROM table_expression
and can appear anywhere a SELECT can. For example, you can use it as part of a UNION, or attach a sort_specification (ORDER BY, LIMIT, and/or OFFSET) to it. VALUES is most commonly used as the data source in an INSERT command, and next most commonly as a subquery.
which, if I understand correctly, isn't consistent with the above-quoted answer text.
If you agree, @AlisdairO, I'm happy to change the exercise text accordingly.
The text was updated successfully, but these errors were encountered:
Exercise: https://www.pgexercises.com/questions/updates/insert3.html
Part of the answer text:
However, a solution with
VALUES
is accepted by the web application:Moreover, the postgresql docs for
VALUES
includes the following:which, if I understand correctly, isn't consistent with the above-quoted answer text.
If you agree, @AlisdairO, I'm happy to change the exercise text accordingly.
The text was updated successfully, but these errors were encountered: