PostgreSQL create table if not exists

This feature has been implemented in Postgres 9.1: For older versions, here is a function to work around it: Call: Notes The columns schemaname and tablename in pg_tables are case-sensitive. If you double-quote identifiers in the CREATE TABLE statement, you need to use the exact same spelling. If you don’t, you need to use lower-case strings. See: Are PostgreSQL column names case-sensitive? pg_tables only contains actual tables. The … Read more

Create a temporary table in a SELECT statement without a separate CREATE TABLE

From the manual found at http://dev.mysql.com/doc/refman/5.7/en/create-table.html You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current session, and is dropped automatically when the session is closed. This means that two different sessions can use the same temporary table name without conflicting with each other or with … Read more

Mysql: Setup the format of DATETIME to ‘DD-MM-YYYY HH:MM:SS’ when creating a table

“MySQL retrieves and displays DATETIME values in ‘YYYY-MM-DD HH:MM:SS’ format.” This is from mysql site. You can store only this type, but you can use one of the many time format functions to change it, when you need to display it. Mysql Time and Date functions For example, one of those functions is the DATE_FORMAT, which … Read more