Print Prime Numbers MediumSQL (Advanced) – HackerRank Solution SQL, Best and Optimal Solutions , All you need.
Solutions of SQL all HackerRank:
Here are all the Solutions of All of SQL of Hacker Rank , Leave a comment for similar posts
SQL Print Prime Numbers MediumSQL (Advanced) HackerRank Solution
with numSel as (
select level num from dual connect by level <= 1000
),
primes as (
select a.num p
from numSel a, numSel b
where b.num <= a.num
group by a.num
having count(case a.num/b.num when trunc(a.num/b.num) then 'Y' end) = 2
)
select listagg(p, '&') within group (order by p)
from primes
;
SQL (Basic)
SQL (Intermediate)
SQL (Advanced)
Basic Select
Advanced Select
Aggregation
Basic Join
Advanced Join
Alternative Queries
Leave a comment below