Skip to content

How to get the size of the duplicates in this query?

Let’s say I have the following data: I want to find out how much data I have in duplicates — that is — if we have one of each of the files (unique by md5) how much space do we save? The answer should be: Here is the base query I have thus far: I think the simplest way to

Does index help a sql select sorting performance?

I have a SQL statement like this: I think the benefit for indexing ‘createdAt’ column is quite minimal, since it does the select first then sort 3 rows. Am I correct? Or it’s better to add indexing? Answer There are two possible indexing strategies for the query you show: Index the IN condit…

Get TOP 1 row from multiple tables based on date

I have five tables in a SQL Server database. These tables are listed below and I want to select Data from these tables according to date. I tried searching but could not find solution for multiple tables. Please help TABLE1 TABLE2 TABLE3 TABLE4 TABLE5 I want to select Label and Date from Table 3, 4 and 5 wher…

logic to create more rows in sql

I have a table1 that I wanted to transform into the expected table. Expected table logic for columns: cal: comes from cal of table1. ID comes from the ID of table1. code: this is populated with lp or fp depending upon if we have a value in f_a then we create a new record with fp as code. corresponding to

Select with update statement sap hana

I’m trying to combine select and update in one statement In select I’m trying to find what is the current Fiscal year fiscal period based on table “month_dim” and by using current date. its …