test=# SELECT COUNT(id) FROM person’ test’# Answer psql is smart enough to guide us. Look at this simple session: The whole statement looks like without n’s
Tag: sql
Boolean values are not mapping properly when using multiset in JOOQ
The ProductCategoryDto class : CategoryAttribute class : The query with needs to be executed is The output for the query is Database create statements: Code generation configuration in pom.xml: I am getting all the boolean fields as null while they are not null in Actual data. How to map the boolean fields pr…
How to generate multiple combinations from tables using SQL?
I have few combinations of records in my table but i want to generate Multiple combinations from original table. Records in table codeset codevalue column system test1 1 null sys1 test2 2 col2 sys1 test3 3 col3 sys1 test3 4 col4 sys1 test3 5 col5 sys1 test4 null col6 sys1 test5 6 col7 sys2 test5 7 col8 sys2 A…
Can a Wildcard Search Be Performed Amongst Fields
Always grateful for the infinite wisdom from everyone on this site. I deal with some massive databases that are often difficult to search in. One of which is a lead database with over 1.4k columns and 3 million records. Sometimes, I just want to query to see if a certain value exists anywhere in the database …
Presto lag dates, group/partitioned by id
Say that I want to find every time that a client updated their budget. Here’s what my data looks like And the code I’ve run. What I’m expecting returned will be Hence there are NULL values for dt_2 in the first entry of each client_id. I’m not sure what code will accomplish this effect…
SQL: SUM on Aggregate columns
I have this query: Which has this result: However, I’d like to add order_total and item_total in order to get just total. So I’d expect this: Doing this did not work: Another monkeywrench is that the type of the numbers is money not integer. Anyone would be able to help? Answer If any of the 2 sum…
Adding hours to dates in Presto
In a Presto db table, I have two string fields, a date of the form, ‘2022-01-01’, and an hour of the form, 22, for 22:00. I’m trying to combine these two elements into a proper timestamp, with date, hours, minutes, seconds. How can I accomplish this? What I’ve tried so far However, I g…
SQL method for returning data from multiple tables based on column names
I am trying to do something a little weird and cannot figure out the right method for getting it done. Essentially I am trying to pull all tables/views and columns where the column name is like some string. In addition to that I would like to pull 1 row of data from that table/view and column combination. The…
Few issues Inserting and filtering XML data to SQL
I’m having a few issues when inserting data from a XML file to a SQL Server database. How can I get the file name dynamically? This file is put on that path with a different number every time but always starts with Idoc and it’s a .xml file. I’m having troubles setting a variable inside OPEN…
Issues Splitting values separated by delimiters and creating columns for each split in snowflake
I am new to snowflake and I am trying to run an sql query that splits values with delimiters(semi-column) and create columns for each of them. Table name: lexa ID Value 001 2021-02-13 18:17:43;83.89.250.196;10.10.11.29 002 2021-02-13 17:47:56;5.33.18.24;10.10.11.28 what I am trying to achieve ID register Ip1 …