Skip to content
Advertisement

How I can index this query in Postgresql?

I’m trying to index my query to optimize the execution time. I tried some b-tree, hash, GIN and GISP index but none of them have been used by the Postgres planner. And even when I define …

Plus sign in the select clause of an SQL

I am working on an old SQL written for Oracle. There is a part of the select clause that I do not understand, even after googling and checking the questions related to the + sign with the key words …

Using Case Statements As a Pivot – DB2 SQL

I want a list of motor carriers, with trailer equipment counts listed in separate columns. I am using case statements to categorize the different equipment types, but I’m getting multiple returns …

select distinct window function in PostgreSQL

I have a data table like the following: How do you select the distinct continuities for each Longitudinal distance in a 10-step rolling window? Ideally, I’d want something in the Ideal output column …

Dividing by decimal values – rounding issue

I’m trying to divide two decimal values, in hope they will return the following; 1.132930. However, SQL appears to be rounding the value to 1.132931. The value returned before conversion is 1.1329305135951. The SQL code i’m using is as follows: Answer You can round the value before the cast as following:

Advertisement