
WHERE EXISTS (SELECT * FROM table_2 t2 WHERE t2.date = t1. IN is very problematic when date could potentially be NULL so if you don't want to use a JOIN then I would suggest EXISTS. You can use it to create, alter, delete databases, tables, etc. WHERE t1.date IN (SELECT date FROM table_2) SQL Shell is a command-line tool to connect and work with the PostgreSQL database. csv file CSV is a universally accepted file data collection format, and many applications output their data in CSV form. If you want to keep the way you had it which typically EXISTS would be better than IN but to to use IN you need an actual SELECT statement in your where. SELECT GENERATE_SERIES('', '', '1 day'::INTERVAL) AS date
Postgresql commands with examples serial#
Overriding a SERIAL column allows us to specify a value of our choice instead of letting it automatically increase on its own. I prefer INNER JOIN over IN or Exists so here is a syntax that should work with a JOIN: WITH table_1 AS ( A SERIAL column can be overridden by the user by explicitly specifying the name of the column in the INSERT statement and providing a corresponding value for that particular column.

It allows you to write queries in SQL syntax, issue those queries to a.

WHERE date IN table_2 is not valid because you never actually reference a value/column from table_2. psql is a PostgreSQL interactive console, or a terminal-based front-end to PostgreSQL.

Note however that you had a second syntax issue in regards to your WHERE statement. In terms of your actual query this syntax should work in PostgreSql, Oracle, and sql-server, well the later typically you will proceed WITH with a semicolon ( WTIH), but that is because typically sql-server folks (myself included) don't end previous statements which need to be ended prior to a CTE being defined. Per the other comments the second Common Table Expression is preceded by a comma not a WITH statement so WITH cte1 AS (SELECT.)
