Skip to main content
0 votes
2 answers
140 views

I am a beginner in SQL. What is the syntax issue with the query shown here? I just needed the random rows to be present n number of times. with recursive cte1 as ( select 1 as idx, company_id, ...
Nidhi's user avatar
  • 21
0 votes
1 answer
89 views

I'm working on Nested Set Hierarchies. I'm using a recursive CTE to build the nested equivalent of adjacency list table. MySQL 8.4 is my platform. -- adjacency list table CREATE TABLE dct_node_adjc ( ...
Felipe Lorenzo's user avatar
1 vote
1 answer
97 views

I have a recursive CTE definition (graph) in Postgres that involves cycle detection: fiddle CREATE TABLE relationships ( subject_type, subject_id, subject_relation, resource_type, ...
Jonathan Whitaker's user avatar
0 votes
1 answer
109 views

Practicing some SQL from Danny Ma's case studies. Working on number 3, found here. The challenge question that I'm requires an iterative table of payments made during 2020. I'm scaffolding up to my ...
Jacob D'Aurizio's user avatar
1 vote
1 answer
173 views

Consider the following tables: create table WORKS_WITH_BASE_COSTS ( CODE integer not null, BASE_COST decfloat default 0 not null, constraint PK_WORKS_WITH_BASE_COSTS primary key (CODE) ); ...
manlio's user avatar
  • 19.1k
0 votes
1 answer
127 views

In SQL Server, I have a Transactions and a TransactionDetails table. Transactions table has the following columns: TransactionId Amount ProcessedDate TransactionDetailsId TransactionDetails table has ...
Gadir Novruzov's user avatar
1 vote
1 answer
29 views

I have a recursive structure with the following two tables: tree represents a hierarchy of nodes where the top node has parent = NULL. the items can be attached to any of the tree nodes, anywhere in ...
Mark Tyers's user avatar
  • 3,319
2 votes
1 answer
106 views

I'm looking to clean up event data that happens to have "duplicate" rows for a given day. I want to remove rows for a day that have more than one status based on the context of the next day'...
alpacafondue's user avatar
0 votes
1 answer
59 views

The code below is from: https://www.freecodecamp.org/news/mysql-common-table-expressions/ Data: CREATE TABLE categories ( id int, cat_name varchar(100), parent_category_id int DEFAULT NULL ...
Kendo96's user avatar
  • 15
1 vote
1 answer
680 views

I am running this query: WITH RECURSIVE base_record AS ( -- Base case: start from the initial defined term SELECT dt.id AS defined_term_id, dt.name AS term_name, 1 AS depth, ARRAY[...
Sinan Guclu's user avatar
  • 1,087
0 votes
2 answers
92 views

I've got a data structure where a record represents a person. A person can have a relationship to another person. There are different types of relationship so it's possible that there can be multiple ...
PaulH567's user avatar
  • 199
0 votes
0 answers
81 views

I'm having a huge performance issue when I run recursive query. Here is my DB Structure: users: id(index) name 1 A 2 B 3 C 4 D 5 E user_user user_id(index) parent_id(index) 2 1 3 2 4 2 5 4 And this is ...
Jack Richard's user avatar
0 votes
1 answer
107 views

I have following table wherein 2 (can be more) foreign key columns define self-relationship between records of the table. [Hierarchical records in my problem dataset] Id Name Parent1__c Parent2__c ...
Ravi Teli's user avatar
1 vote
1 answer
85 views

I have seen and read many posts on using a recursive CTE to get the hierarchy from a self-related table. I want to get just the root node of an entry in my table. In other words, if I have a suburb ...
Chris Laurie's user avatar
0 votes
2 answers
141 views

I have an SQL-Server 2019 database with 2 tables NODE and EDGE, where NODE consists of two columns ID (int) and NAME (varchar) and EDGE consists of two columns PARENTELEMENTID (int) and CHILDELEMENTID(...
Zyan's user avatar
  • 69

15 30 50 per page
1
2 3 4 5
11