I’m trying to import a .csv file to my postgresql DB. I created a table as follows: Then I used the following command to import the .csv file And my .csv file contains the following: However, this doesn’t work and the following message appear: Answer Maybe there is a BOM in the CSV? hexdump the fi…
Tag: postgresql
How do I utilize a WHERE clause with a MONEY data type?
So to keep it simple, I’m working on a problem that requires a simple case of utilizing the WHERE clause to bring back records that have the field (we’ll call it ‘tax’) equal to $0.00 So as per usual, I thought I could do: WHERE tax = 0; But I keep getting an error. And I’m prett…
With PostgreSQL how to determine the average completion time given two time stamps while accounting for nulls
In my PostgreSQL database I have an invitations table with the following fields: Invitations: id, created_at, completed_at (timestamp) I am working to write a PostgreSQL query that tells me the …
Trigger delete on many-to-many middle table deletion
There are two tables A and B. As they have a many-to-many relation, there’s also table C. A —— id PK B —— id PK C —— id_A PK id_B PK Now, a row B only exists only exists when at least …
PostgreSQL json_build_object nested
First things first: I’m using PostgreSQL 11.6, compiled by Visual C++ build 1800, 64-bit. 🙂 Im trying to create a JSON object directly from the database. My desired result is { “1”: [], “…
How to get specific objects value from JSONB array in PostgreSQL?
I have a column named people and it’s type is JSONB. Here is the sample data (1 row): {“addresses”: [{“street”:”cubuklu”, “valid?”: “true”} {“street”:”beykoz”, “valid?”:”false”} …
How to Join Tables on Datetime within a margin of seconds
I have 10 tables: Table1, Table2, …, Table10 Each one with the columns: id text datetime My task is to join the Table1.datetime with the rest of the 9 tables.datetime (+-3seconds on the 9 tables)…
Which the best way to use inheritance of tables in postgreSQL?
i want to use inheritance in my database (PostgreSQL) so i wrote this code but finally i found there are inherits in PostgreSQL CREATE SEQUENCE public.user_account_id_seq; CREATE TABLE public….
PostgreSQL result of first query used in second query
Sample Data: |lastmodified|Number1|Number2|password_mod| |2020-01-25 |250000 |100000 |true | |2020-01-26 |250000 |200000 |false | |2020-02-01 |300000 |200000 |false | |2020-02-…
Ideal Postgres Index For Json Data With Integer Timestamp
I have millions of records in this table using Amazon Aurora Postgres 10.7: Example row: {“id”: “abc”, “ts”: 1580879910, “data”: “my stuff”} I have these queries that take dozens of seconds: I’m trying to improve performance here, and these are…