I have to run many select from one script like : How to save result for all SELECT in SQL Developer ? Answer A simple option is to spool result into a file. Here’s how:
Tag: sql
Copy text and find corresponding match to insert in another table [postgreql]
I try to migrate an existint text field into a many-to-many relationship. I would like to insert in offer_work_days the correspondences to have this result How can I achieve this with sql (on postgres)? Answer demo:db<>fiddle You have to JOIN the tables on the text column, return only the id columns and insert the result into your new table.
What is the maximum query length accepted for a PostgreSQL multi-valued SELECT query?
The context is that I am writing a script to send load/insert query to a postgres server to insert rows into an existent table. I read many resources about the topic, about the approach to choose, between “COPY” and multi-valued SELECT query. I want to know what is the maximum query length accepted for a PostgreSQL multi-valued SELECT query ?
enable compression in TimeScaleDB hypertable – invalid column name
When I try and enable compression on my TimeScale DB hypertable using this query: I get the following error: All I can say is that AssetId is a valid column in the Session table. I’m not sure what else to try. Is anybody familiar with this error and could offer a solution please? Thank you Answer Sometimes Postgresql requires the
SQL: Creating quarter values based off conditional statements
I have the following table: jan feb mar apr may jun jul aug sep oct nov dec 322 44 1222 These are invoice amount columns. They’re based off of the months of the year. What I’m trying to do is make a new column called execution window that will have different quarter values depending on where the amounts show up
Grouping columns to find most popular product for each country
I’m a SQL beginner, practicing through various sources. I have a table called marketing_data containing product sales information, country and other variables where I’m trying to get an output for the most popular product per country, based on sales. I don’t know where to begin with my syntax. This is how the data looks in the table I’ve previously run
Pass Parameters in Pivot SQL
I had this query below and got an error with parameter @emp_group during execution. Need your suggestion on how to pass the parameter. The query will run when removing the parameter but need to filter the records. thanks in advance. Answer You can can do the same thing with @emp_group like you did with @cols. Extract them vom the text
Combine rows by consecutive timestamp
I have an input table as below: name time price one 2022-11-22 19:00:00 UTC 12 one 2022-11-23 7:00:00 UTC 24 one 2022-11-23 19:00:00 UTC 10 one 2022-11-24 7:00:00 UTC 20 My expected output is: name time price one 2022-11-22 36 one 2022-11-23 30 Explanation: I have to group-by 2 consecutive timestamps, the prev date 19:00:00 UTC and the next date
SQL query to extract matching diagonal pairs in SQL Server database
I have a database table (mytable) with 2 columns x and y as shown below, from which I intend to extract rows with matching diagonal pairs of (x,y) and (y,x) e.g., 4 21 and 21 4 I have tried the accepted code on stackoverflow here (enter link description here) on my mytable which gives me the expected results on Oracle
Prisma problem inserting into autogenerated int ID field: integer out of range for type int4
This is strange because the id column is an Int and should be default autoincrementing. The error message complains about int4. If I look in the database the only int4 column is the id field. Answer It seems your users are too active, if there is more than 2.147.483.647 comment ids, the Int id has reach it max value You