Hey Lawson, good learning!
For a quick to write / read fizzbuzz in SQL I recommend looking at % (modulo math symbol) and CASE statements. Also I’d create my list of numbers with a recursive CTE for ease of having it all in a single statement (no temp tables). Here’s a rough idea of what I was thinking
declare @maxNum int = 30;
;with ListOfNumbers as (
select 1 as num
select num + 1 from ListOfNumbers x
where x.num < @maxNum
when num % 15 = 0 then 'FizzBuzz'
when num % 3 = 0 then 'Fizz'
when num % 5 = 0 then 'Buzz'
else cast(num as varchar(10))
While a bit of an interview trope, I think FizzBuzz is still a good way to see what you get in a programmer — some people may get to the right answer, others may get there more elegantly. I’ve spent waaay too many years in SQL and have all these tricks and tools at my disposal, I therefore have a shorter solution. You are newer to SQL, and for sure get it to work, while exploring different ideas along the way. I’m not trying to imply your solution isn’t a good one to show off who you are — you are someone who’s willing and able to explore something new, and articulate what you’re trying. And those are great qualities that people want to find out in a technical interview. Kudos.