Skip to content
Advertisement

Tag: sql

How can I group a joined query with linq

I’m trying to produce a data set for a graph that would get me the same result as the following SQL query: But if I try to translate it into a linq query, I can’t get the same result, I either don’t have access to one or the other side of the junction, or I get a yearly total of

Finding a phone number by entering a string SQL

I want to find the phone number in the database by entry into the string, while I wrote this. But if, for example, the number starts with +3 and not only with +7. Any help would be welcome. in SQL I am newbie For example, there is a Users table with a phone column. There are numbers starting at +

The difference between two values from different rows grouping by column

Let’s say there is a table jd_log: What im trying to do, is to find the difference between 2 durations (as duration_diff) for each unique job_name. It is guaranteed, that for each unique job_name there will be no more than 2 entries in the table with such job_name. If there is only 1 entry for specific job_name, duration_diff should be

Getting total from query of individual groups

I’ running a query that returns total count of offices per county. and my results look like this: Is there a way to get the total count returned in the same query? Answer If you want it as a column, use a window function: If you want it as an additional row, then use WITH ROLLUP:

SQL Query from getting SubChild to Child to Parent Tables

Good day, I’m trying to create a custom query for my scenario. Here’s the DEMO I created. Suppose I have 2 or more parent tables and this table will be consume by a child table. tblParent1 tblParent2 tblParent3 Then there’s a child table where it consumes these 3 parent tables. tblChild And the child of child table tblChildOfChild What I

Oracle: Id Not in another table

I have following two tables, airport and flying I would like to get airport_id where flying_id present in flying table but not present in airport table. I rote the following query using nested select query. Is there anyway I can improve without writing nested? Answer There are two ways. LEFT JOIN NOT EXISTS

SQL (BigQuery) Grouping Runtime Per Day

I have the following data which I want to group into seconds per day in BigQuery. Source Table: +————–+———————+———————+ | ComputerName | StartDatetime | EndDatetime | +————–+———————+———————+ | Computer1 | 2020-06-10T21:01:28 | 2020-06-10T21:20:19 | +————–+———————+———————+ | Computer1 | 2020-06-10T22:54:01 | 2020-06-11T05:21:48 | +————–+———————+———————+ | Computer2 | 2020-06-08T09:11:54 | 2020-06-10T11:36:27 | +————–+———————+———————+ I want to be able to visualise the data

Advertisement