3

I am trying to find the right description for the parts of a query:

  1. What is the name of the part between SELECT and FROM? If I only had some columns then I would call it "column identifiers". But if there are any function or subqueries this would be quite a bit more. Is "SELECT clause" a valid description?
  2. Same thing for the FROM part. If I have only one table I would simply call it "table". But if there is a more complicated structure maybe using joins, etc. what would be the correct naming?

To make my questions more clear:

In Postgres I could use a JSON function, e.g. json_array_elements in both parts:

SELECT
 json_array_elements(my_json_column)
FROM
 my_table

or doing this

SELECT
 elem.*
FROM
 my_table,
 json_array_elements(my_json_column) AS elem

If I have to tell somebody that this function can be used within the SELECT clause or as part of the FROM clause which terms are more conventional?

Tony Hinkle
8,0921 gold badge24 silver badges46 bronze badges
asked Mar 6, 2019 at 16:59
0

1 Answer 1

3

It's usually called a "select list", which contains "select list items".

The FROM clause contains a list of table references.

This is not specific to Postgres, by the way.

So, with respect to your use case you might say that json_array_elements() can be used both as an expression in the select list and as a table reference.

answered Mar 6, 2019 at 17:08
3
  • OK, sounds legit. How would you call the same for the FROM clause? Maybe if you would have to say something like: "You can use the function inside the FROM clause as part of a join..." or something like that? (see part 2 of my question :) ) Commented Mar 6, 2019 at 17:14
  • 2
    @S-Man: I usually use "from list" for that Commented Mar 6, 2019 at 17:24
  • 1
    "FROM list" here, too. Commented Mar 6, 2019 at 19:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.