I’m new to HQL. I need to fetch all the records from table A based on the following 2 condition using HQL/SQL query: Person ID which satisfies both these conditions “(Music < 100) and (Dance !...
Tag: sql
How to create LinkedList of JPA entities
I have a scenario where I need to create an entity which has references to list of predecessors and list of successors. when a request is received, I need to create entity like below: Request: My new entity “task2” should now be created as below in DB. While saving task2 with previous as task1 and…
get 2nd highest sum in mysql
i have table emp : emp_id quantity 1001 21 1001 10 1002 3 1002 5 1004 4 1004 5 1004 8 i want to get the id having 2nd highest sum so expected output is 1004 17 let me know how can …
Why is my “CREATE INDEX CONCURRENTLY ..” command blocked by a “SELECT FROM” query? (Postgres 9.6)
I was running a migration to create an index, but the migration was blocked by another query. I resolved the problem after discovering that there was another query blocking my migrations; and after …
How to get observation frequency counts from multiple dataset into one table?
I have a bunch of large datasets. DS_1 (contains all unique IDs and names): DS_2: DS_3: I’m looking to create a new dataset that shows frequency counts across the datasets (and lastly calculates Total_Obs). I would output something like this: The datasets are fairly large. Is there a more efficient way …
Query returns duplicate values [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question The query below is showing some duplicate and wrong values: The output should look like this:…
SQL – Finding Percent Of a Total and subtracting to get two new totals
In my SQL course I’m trying to answer a problem in which i’m being asked to find X% of a Total then subtracting that result from the original total to produce another result. Then putting these …
Access database presenting date in ddmmmyyyy format
I have an Access DB where its date is given in ddMMMyyyy (ex: 27SEP2020). Each time I try and set the data type as a date, it deletes the entire column of over 450 entries. Is there a way to either …
Using two single-column indexes in where and orderby clause
I have googled a lot and couldn’t find a clear answer to my question assume we have this query SELECT * WHERE user_id = x ORDER BY date_created If we have a single column index on user_id and another …
Transaction Mode in SQL
I was reading through the BNF grammar for transaction statements and saw that transaction modes can be specified directly in the START TRANSACTION statement. Is there a difference in specifying transaction modes in START TRANSACTION vs SET TRANSACTION statements? Answer No difference. The SET TRANSACTION sett…