Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
101 views

This is an idea of how my table looks - no country language translatedName 1 c1 en test1EN1 1 c1 l1 testL1 2 c2 en test1EN2 2 c2 l2 testL2 This is how the data might look like where a country can have ...
Avani Agrawal Nath's user avatar
1 vote
0 answers
63 views

I am code reviewing an incremental model in dbt. The staging model contains a Primary Key called ID. The table resource in our source DB (SQL Server) contains Primary Key called ID. There is a field ...
macromind's user avatar
  • 143
1 vote
1 answer
67 views

I have an Employees table with the following structure: ID Name ManagerID Salary 1 Alice NULL 90000 2 Bob 1 80000 3 Charlie 1 85000 4 David 2 75000 5 Eve 2 70000 6 Frank 3 72000 I need a single SQL ...
Safwaa Samin's user avatar
0 votes
2 answers
209 views

Sometimes you want all pairs of rows in a table: its Cartesian product with itself. That could be done with a join. drop table if exists #a create table #a (x int) insert into #a values (1),(2),(3) ...
Ed Avis's user avatar
  • 1,622
4 votes
2 answers
105 views

I have a case where I have a list of pairs, each with two numerical values. I want to find the subset of these elements containing only those pairs that are not exceeded by both elements of another (...
teepee's user avatar
  • 2,724
0 votes
1 answer
63 views

I am using this SQL query to collect and analyze shift production data. The result of the query gives me almost what I want but not quite as the infeed, outfeed, and scrap counts are in separate rows. ...
Arlyn Buondonno's user avatar
1 vote
1 answer
38 views

I want to write a query that returns names and their best friends name from the table below: Example FRIEND Table: FriendID Name BestFriendID 1 Abby 2 Bob 3 3 Carl 2 Expected Output: Name Bestfriend ...
ConsistentToast's user avatar
-1 votes
1 answer
95 views

I am refactoring some code that was written by another person that is no longer around. In this query a MAX(Date) is being selected, but then joined to they same table via MAX(Locator). The locator is ...
randamus's user avatar
2 votes
3 answers
128 views

Data Definition I have a status table like so, attributes not relevant to the question are omitted: id created value 1 2024-06-24T13:01:00 error 2 2024-06-24T13:02:00 ok 3 2024-06-24T13:03:00 warning ...
nouser2013's user avatar
0 votes
3 answers
65 views

I'm studying Employees Sample Database which has the following table. create table dept_emp ( emp_no int not null, dept_no char(4) not null, from_date date not null, ...
Jin Kwon's user avatar
  • 22.4k
-1 votes
1 answer
38 views

Sample data AIID NIC Status Remarks ID AddedBy ADT 28 9595 ON THE WAY NO 8 0 2024-06-06 16:02:33 27 9595 ABSENT NO 8 0 2024-05-20 16:02:33 26 573 VISITED NO 10 0 2024-05-09 15:31:55 25 573 ON THE WAY ...
RITZ's user avatar
  • 1
2 votes
2 answers
135 views

I'm trying to build session logic based on DateTime value for a group of columns (like Userid, DeviceId) For a given userid, deviceid the session can start any time of the day(first event) and I want ...
srinivas munagala's user avatar
0 votes
1 answer
160 views

I was going through my course material for the SQL class that I am taking and it mentioned that in order to make programs run faster and run in one pass using joins verses a subquery. It stated that ...
ImpossibleInc's user avatar
0 votes
1 answer
212 views

I have an entity called Position with foreign key to itself: int Id; and int ParentId;.This gives me two navigation properties: Position Parent; and List<Position> Children;. When I'm loading ...
Ivan Koshelev's user avatar
-1 votes
1 answer
57 views

edit: I have a db table with two columns: id and dep, that lists all department names. is it possible to run a query (either self join or subquery) that returns the dep column twice (dep1 and dep2). ...
user1469's user avatar
  • 109
1 vote
1 answer
276 views

I'm working on subqueries in the Google Data Analytics Course. There are many places you can rent bikes from. These places are bike stations. The query is to calculate the difference between average ...
Razi Syed's user avatar
0 votes
1 answer
139 views

I want to make my end node send join requests to the gateway continuously. My goal is to send join requests continuously until the end node connected to the gateway, and if the connection is broken ...
Mr._Nileshkumar_Solanki's user avatar
0 votes
1 answer
234 views

I am encountering a StackOverflowError in my Spring Boot application when attempting to serialize a DTO class (NodeAttributesDTO) that has a self-referencing relationship. The error occurs during the ...
Niloufar Moradi's user avatar
-1 votes
1 answer
86 views

Is there a quick and simple way in SQL to accomplish this, I have drawn up a long way to prevent this, by doing a "nested" self reference. Is there a simpler way? Issue: When you are ...
Austin Dady's user avatar
1 vote
2 answers
78 views

Here's a data.table, with some parameters for each id by some regular quarterly dates. It's originally shuffled randomly, but, at first, let say, it is sorted by fab_date and id. set.seed(1) dt_to_fun ...
Howdyouride's user avatar
-2 votes
1 answer
90 views

I have a task to get the common students who have taken the exam in the current month (November 2023) and must have taken at least one attempt in last 12 months as well. So the look back period is of ...
Jaideep's user avatar
  • 15
1 vote
1 answer
115 views

table customer id login 1 2016-03-01 1 2016-03-02 1 2016-03-03 1 2016-03-05 1 2016-03-06 1 2016-03-07 1 2016-03-08 I want to find what is the maximum number of times the customer id logged in ...
Krishnam Vats's user avatar
0 votes
4 answers
77 views

I have a table with two columns. First one is an autoincrement ID column, second one is a datetime column where next data should be in future to the previous. I need to select values where it is not ...
Іван Крічфолуші's user avatar
0 votes
2 answers
79 views

Please help with self join inside one table by different fields. given table "Items": Used PostgreSQL. I need to get all the values from such table, for which factId = 'fact:170' and factId1 ...
Heineken's user avatar
0 votes
4 answers
88 views

Suppose, we've a table named college. In this table we've the following columns: College ID, College name, State and Established in. Now I want to find the names only of those colleges where the ...
MD Junaiedur Rahman 's user avatar
-2 votes
1 answer
82 views

I've two tables, the users: and the scores of exercise of the users, paperId shows the exercise ID, and the firstTry shows if it is the first try (value 0) or not (others value): For a given ...
xaero's user avatar
  • 241
0 votes
2 answers
81 views

CREATE TABLE accounts ( "id" INTEGER, "parent_account" INTEGER, "merchant_type" VARCHAR(8), "name" VARCHAR(32) ); INSERT INTO accounts ("id"...
Yogyakartas's user avatar
0 votes
2 answers
502 views

I'm working on this problem from LeetCode.com: Column Name Type machine_id int process_id int activity_type enum timestamp float The table shows the user activities for a factory website. (machine_id, ...
Burton_Gustice's user avatar
0 votes
1 answer
53 views

I am learning SQl on microsoft learn. During an exercise Microsoft provided a datamodel. On the bottom Right there is a line with a key pointing to itself. What does that mean?
Kees Lasser's user avatar
0 votes
1 answer
107 views

I have this table: data MyTable; input Household age gender $ flag; datalines; 1 45 male married 1 35 female married 2 50 female married 2 52 male married 3 32 male child 3 50 male married 3 ...
Kristián Óvári's user avatar
0 votes
1 answer
86 views

How can I make a query that aggregates data from entities and their children down to the lowest level? I have two tables. The first is tblEntity, a self-join table with entity and parent entity ...
jason's user avatar
  • 1
0 votes
1 answer
44 views

I want to query a self join that will only join on the first condition and only if it cant find a match it will join the second condition I tried this syntax which doesnt work for me, because it will ...
user avatar
0 votes
1 answer
548 views

I have purchases, which may (or may not) have an associated sub-purchase, which i've modelled with a self-join as: class Purchase < ApplicationRecord has_one :sub_purchase, class_name: 'Purchase',...
Dan SimBed's user avatar
1 vote
1 answer
62 views

There is a data.table, which has some data for different id's on yearly basis: example_data <- data.table( id = c('id1', 'id1', 'id1', 'id2', 'id2', 'id2', 'id2', 'id2'), year = c(2010, 2011, ...
Howdyouride's user avatar
0 votes
1 answer
79 views

For my Employee class, I have the following self-joinig associations: class Employee < ApplicationRecord belongs_to :replaces_employee, class_name: "Employee", optional: true has_one ...
nmadoug's user avatar
  • 47
1 vote
1 answer
45 views

I come across a query which is, SELECT it1.survey_set_id, it1.type, it1.value FROM survey_condition_filter it1 LEFT JOIN survey_condition_filter it2 ON(it1.survey_set_id = it2.survey_set_id AND it2....
user avatar
1 vote
1 answer
67 views

Let's assume the following dataframe: library(dplyr) dat <- tibble( Structure = c("A", "B", "X", "A-X", "B-X", "C-X", "A-Y"...
Schmuddi's user avatar
  • 2,106
-2 votes
1 answer
163 views

What will happen if I join a dataframe/RDD/dataset with itself, i.e. do a self-join, and do a broadcast of the same dataframe/RDD/dataset in the operation? The broadcast and self-join can't work ...
Sanket Mehta's user avatar
-3 votes
1 answer
219 views

I have a table formatted as such age height name 15 180 george 16 192 phil 20 148 lily 17 187 george 19 196 phil 24 147 lily 19 190 george 20 199 phil 22 148 lily 21 190 george 27 197 phil 60 138 lily ...
AlbinoRhino's user avatar
-1 votes
1 answer
96 views

I have one table with 4 columns. The first column contains Group_ID. The 2nd column contains the Contact_ID. Columns 3 and 4 contain First Name and Relationship (respectively). I would like to show ...
Frisco's user avatar
  • 1
-1 votes
1 answer
63 views

select * from ( select * from ( select *, unnest(product_ids) as product_id from orders ) t1 inner join ( select *, unnest(product_ids) as product_id_1 from orders ) t2 on t1....
Георгий Мальцев's user avatar
0 votes
1 answer
930 views

I am trying to find a supervisor ID of an employee based on the organization unit. Table A: Employee EmpID BeginDate EndDate OrgUnit 1001 20070618 20070624 5001 Table B: OrgUnit OrgType OrgUnit Code ...
AKS's user avatar
  • 21
0 votes
1 answer
77 views

I have the entity Event which will have 1 or more EventDay(s), that will represent a contignous time period in a given day. e.g. Event A has 2 EventDays: EventDay 1 - date: 10.10.2000; startingAt: 10:...
Mar's user avatar
  • 187
0 votes
1 answer
49 views

I have some trouble trying to fetch some manytomanyrelated data in by Django Application Here is my model : SoftwareVersion(models.Model): id = models.AutoField( primary_key=True, ...
Xibutox's user avatar
0 votes
0 answers
53 views

I want to fetch records from a table. I have 2 records for each invoice in a table and I want to join them so that I can show 1 record. The situation is something like this: I have 2 invoice records ...
Shahreyar Butt's user avatar
-1 votes
2 answers
43 views

Let's say I have a table with logs. The value of status column may be NULL and I would like to UPDATE this value by copying value from the log for same settingid which have non-NULL status and closest ...
vanishingESCkey's user avatar
-1 votes
1 answer
69 views

So, I want to show which employees (names) have subordinates and how many subordinates they have (I was using self-join). It works fine if I use count and group by looking at the "manager_id"...
user14474247's user avatar
0 votes
1 answer
125 views

I have an application to work on employee shifts for factories. I have a SQL query to find out if shifts have conflicts: if you have a shift 08:00-16:00 and I assign another shift 09:00-17:00 on the ...
mrcasals's user avatar
  • 1,169
-2 votes
1 answer
85 views

I'm using SQL Server with a table about video game sales from the years (1977-2020). The query below is what I've been using to solve the problem: finding the #1 game with the highest sales for each ...
Nickolas Jaramillo's user avatar
0 votes
2 answers
130 views

I have a table foo: some_fk some_field some_date_field 1 A 1990-01-01 1 B 1990-01-02 1 C 1990-03-01 1 X 1990-04-01 2 B 1990-01-01 2 B 1990-01-05 2 Z 1991-04-11 2 C 1992-01-01 2 B 1992-02-01 2 Y 1992-...
Ethan's user avatar
  • 35

1
2 3 4 5
26