Expression for some special SQL queries

While I’m not native English speaker, I often need to express myself in English.

For a week, I have been searching for a term which represents a kind of SQL query:

SELECT something FROM somewhere WHERE somethingElse IN (SELECT foo FROM bar)

It’s a query within another (those in brackets). What term should I use to describe it?

  • A nested query
  • An embedded query
  • An included query
  • A sub-query
  • Another term?

Thanks,

Answer

This form is called a subselect by IBM. However, a more popular synonym is a subquery, which is used by Oracle. One page says

Subquery or Inner query or Nested query is a query in a query.

Usage on Stackoverflow:

  • Subquery, 27,768 posts, 2,552 tags
  • Subselect, 3,596 posts, 218 tags
  • Inner query, 1,439 posts, 19 tags
  • Nested query, 835 posts, 106 tags

I suggest you use either of the two most popular terms.

Attribution
Source : Link , Question Author : Fractaliste , Answer Author : rajah9

Leave a Comment