Тёмный

Is RECURSION possible with SQL ? 

Подписаться
Просмотров 1,2 тыс.
% 91

When trying to solve complex problems in computing or mathematics, a recursive algorithm might be the most elegant approach to a solution. Many languages support recursive function calls to support this, but can a single SQL statement be recursive?
Follow me!
blog: connor-mcdonald.com
twitter: connor_mc_d
The Podcast!
podcasts.apple.com/au/podcast/the-spoken-nerd/id1552316025
open.spotify.com/show/5dqVVftZhw0lu1fnX20TiP
Subscribe for new tech videos every week
Other social media channels here: linktr.ee/connor
Music: Night Owl (Broke For Free), Kevin Mcleod (incomptech), Dyalla
#sql #database

Наука

Опубликовано:

 

10 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 8   
@sriramjaisankar9121
@sriramjaisankar9121 23 дня назад
It's amazing. Learnt a new concept today...!!!!
@DatabaseDude
@DatabaseDude 22 дня назад
Glad to hear that
@mayureshthorat8701
@mayureshthorat8701 23 дня назад
Can you make video on database refresh where source is having 1 pdb and target is having multiple pdb, and we need to refresh/duplicate only one pdb. Other scenario, The source is non pdb in 12c version and target is multitenant in 19c, where we want to refresh only 1 pdb out of n pdbs.
@DatabaseDude
@DatabaseDude 22 дня назад
Do you mean DataPump? or RMAN? or refreshable pdb?
@hellohiavi
@hellohiavi 23 дня назад
Great ❤
@DatabaseDude
@DatabaseDude 22 дня назад
thank you!
@jriosfer
@jriosfer 21 день назад
The result could be easier using LAG instead of using WITH
@DatabaseDude
@DatabaseDude 20 дней назад
Lets see your LAG solution for this simplified example create table t ( pk int, x int ); insert into t values ( 1, 10 ); insert into t values ( 2, 5 ); insert into t values ( 3, 18 ); insert into t values ( 4, 21 ); insert into t values ( 5, 23 ); insert into t values ( 6, 5 ); insert into t values ( 7, 12 ); SQL> with r(k,res) as 2 ( select pk k, x res from t where pk = 1 3 union all 4 select t.pk, r.res*1.1+t.x 5 from t, r 6 where t.pk = r.k+1 7 ) 8 select * from r; K RES ---------- ---------- 1 10 2 16 3 35.6 4 60.16 5 89.176 6 103.0936 7 125.40296 7 rows selected.