![sql list of prime numbers sql list of prime numbers](https://static.wikia.nocookie.net/dragonball/images/f/f9/Dbz_blu_ray.jpeg)
Set and have created the stored procedure which has a parameter to find the prime numbers up to that given number Tested on SampleDB of local server CREATE procedure int)
#SQL LIST OF PRIME NUMBERS CODE#
The below code works to find prime numbers in SQL Now similar queries can be used: select 2 as p union all Similar to kordirkos algorithm: select 2 as p union allĬreate temporary table if not exists q engine=memory
![sql list of prime numbers sql list of prime numbers](https://cdn.shopify.com/s/files/1/0759/5899/products/dragon-ball-z-kai-dvd-complete-season-1-7-set-dvds-blu-ray-discs-dvds-704400088346-11906522906660_2000x.jpg)
SELECT * FROM generate_series( 2, 1000 ) xĪns an equivalent version for Oracle: WITH x AS(ĬONNECT BY LEVEL y.x AND remainder( x.x, y.x) = 0 If you prefer SQL, then this works WITH x AS ( Note: a list of prime numbers was copied from.