Skip to content
Advertisement

How can I obtain the primary key for a row associated with the minimum value in a subset specified in a group by?

I have been working on some database queries and am running into some issues with trying to obtain a primary key for a row where an aggregated value was obtained. I am using Postgresql v10. Take for example the following table: instructor_schedule_id instructor_name course_name start_date 1 bob databases 2015-01-01 00:00:00.000000 +00:00 2 bob databases 2018-01-01 00:00:00.000000 +00:00 3 bob databases

Extracting a string from a nested dictionary in presto

I have data that looks like this: I’d like to extract “subquestions” into separate rows (in an sql table): — Making ads for Meta platforms — Producing video content — Applying mobile creatives best… I have a tried a few functions json_extract_scalar, and Map functions etc, but I didn’t succeed. Thanks in advance for your help. So the thing I

SUBSELECT (SQL)

I have to tables. The first table (customers) shows data about the customers (id, firstname, lastname). The second table shows data about the orders (timestamp and customer id). So, i wanted to see the last order by a customer in my table “customers” and did a SUBSELECT and it worked. But, there are some customers who never ordered something and

Convert Sql to linq with groupby

I have view on which I use this request And it’s running sucessfully and get me this data How I need to write it using linq to get same data? I tried like this But on new HumpChartDto() {SpendBand = x.SpendBand} I got Cannot resolve symbol ‘SpendBand How I can solve this? Answer First, after grouping on SpendBand, you need

Oracle Hierarchy – How to get a particular level record in a query?

We have the following structure for Organizations. Query returns the result What I’m trying to do is let’s say I need to get the Department (Information Technology Department) of org_id 4 (Database Unit), how should I build the query for that? Currently we built a function that returns the department id which basically loops until it reaches the DEP parent.

SQL- parse data

I am creating a Test Automation ‘Health Page’ On this page I would like to display a 7 day trend of how many tests ended with status PASS/FAIL/UNDEFINED. I am doing it in Oracle Application Express. I would like the graph to look something like this: However I do not know how to separate the results into days. Here is

Advertisement