Does SQL have a function similar to the range function in python that will generate a set of increasing numerics? I am aware of the identity function, but I don’t want to keep on creating and recreating tables just so I can get a set of increasing numbers.
Ultimately, I want to be able to dynamically create a range of numbers based on the results of a search function, eg
count(*) from teams where team= 'knicks'
would give me a number, say 20
an then I dynamically use that number as part of a function
function(20) ---> 1,2,3,4,5,6... 20
I want to use the result of the function to have a sorted table where each number corresponds to a player. I can’t use identity here, because I’m keeping all the teams in one table, and I’ll use the team name to pull out numbered team lists.
Still shakey on how to use stackoverflow’s designing, so please bear with.
Try SQL SEQUENCE. For example this guide.
/edit: i´ve read it again, and maybe you should try to make better design of DB. Use normalizations… I don’t really understand this sentence: