Im reading data from a tsv-file to a postgresql table. The problem I have is that in one column (death year) it is either a year or N if the actor is not dead yet. If i try to use INTEGER as data type I get an error because of the N. Do anyone know how to solve this? This
Tag: postgresql
Unable to join queries
I hope you’re able to help with this, it is creating a lot of unnecessary work for me… I have a lot of users that are assigned a unique session_id each time they start the game. This means they can get multiple session_id ‘s in a single day if they crash and/or just restart the app. I want to be
How do I create cohorts of users from month of first order, then count information about those orders in SQL?
I’m trying to use SQL to: Create user cohorts by the month of their first order Sum the total of all the order amounts bought by that cohort all-time Output the cohort name (its month), the cohort size (total users who made first purchase in that month), total_revenue (all order revenue from the users in that cohort), and avg_revenue (the
can not check whether a table exists or not in postgresql
I’m writing a C program that connects to a postgreql db.I’m trying to check for a table : this variable is a global variable. but when I compile the code this error occurs: Answer If this is a global variable, C requires that it be initialized with something known at compile time; if it requires a call to PQexec(), this
PostgreSQL ltree find all child node of a given path (With out using expression)
Only child node of given path (Except the given path) Query: select path from tree where path <@ 'a.b.c'; Result: Expected result: All the below node of a.b.c (In result don't needed a.b.c)
How to update numerical column of one table based on matching string column from another table in SQL
I want to update numerical columns of one table based on matching string columns from another table.i.e., I have a table (let’s say table1) with 100 records containing 5 string (or text) columns and 10 numerical columns. Now I have another table that has the same structure (columns) and 20 records. In this, few records contain updated data of table1
How to run SQL query with inside a javascript loop(map)?
what I’m trying to do is: loop through array of objects using map function run multiple SQL queries according to object append result of queries with object I’m looping through offers which is array of object.I get free_item and buy_item which are associated with offer.I am using knexjs for postgresql database with nodejs Here’s actual code: The Problem is it
PostgreSQL: aggregate records by time interval
I would like to generate reports of GPS capturing rate by travel modes. I have in a table modes the type of travel modes used by users. So for example, the following is the sample data for travel mode by user 10 for different trips. And then for each user and for each trip, user’s GPS traces are recorded in
Skip rows if subquery returns multiple rows in Postgres
I want to update table prod_replay_out based on subquery results in Postgres. However, subquery returns multiple rows but I want to skip those rows and update table based on single rows return by subquery. I have referred link Subquery returns more than 1 row error but max() function will not apply for my expected results. Could you please provide me
Using PostgreSQL COPY
I’m using JMeter for insert summary data file to PostgreSQL. I tried copy instead of COPY but I’m getting error at copy syntax. I found out COPY is for only server-side, so I us copy for client-side. Here is my query Here is the error: org.postgresql.util.PSQLException: ERROR: syntax error at or near “” at position: 1 Answer copy is not