OurBigBook About$ Donate
 Sign in+ Sign up
by Ciro Santilli (@cirosantilli, 37)

Common Table Expression (CTE)

 ... Type of database Relational database Relational database management system SQL SQL feature SQL subquery
 0 By others on same topic  0 Discussions  Updated 2025-05-13  +Created 1970-01-01  See my version
Similar to SQL subquery, but with some differences: stackoverflow.com/questions/706972/difference-between-cte-and-subquery
rm -f tmp.sqlite
sqlite3 tmp.sqlite 'create table t(i integer)'
sqlite3 tmp.sqlite 'insert into t values (1), (2)'
sqlite3 tmp.sqlite 'with mycte as ( select * from t ) delete from mycte where i = 1'
sqlite3 tmp.sqlite 'select * from t'
  • Table of contents
    • CTE insert values Common Table Expression

CTE insert values

 0  0 
Common Table Expression
Useful for testing: stackoverflow.com/questions/21819183/how-to-use-ctes-with-update-delete-on-sqlite
sqlite3 :memory: 'WITH t (i, j) AS (VALUES (1, -1), (2, -2)) SELECT * FROM t'

 Ancestors (13)

  1. SQL subquery
  2. SQL feature
  3. SQL
  4. Relational database management system
  5. Relational database
  6. Type of database
  7. Database
  8. Software
  9. Computer
  10. Information technology
  11. Area of technology
  12. Technology
  13.  Home

 View article source

 Discussion (0)

+ New discussion

There are no discussions about this article yet.

 Articles by others on the same topic (0)

There are currently no matching articles.
  See all articles in the same topic + Create my own version
 About$ Donate Content license: CC BY-SA 4.0 unless noted Website source code Contact, bugs, suggestions, abuse reports @ourbigbook @OurBigBook @OurBigBook