Pony2
Coder
Hi all,
I'm having difficulty solving a SQL query question that I recently encountered online. I'm trying to write a query that will return the sum of all odd integers from 1 to 100, but I'm not sure how to go about it.
Here is the code I have so far:
SELECT SUM(column_name)
FROM table_name
WHERE column_name % 2 != 0;
I'm not sure if this is the correct approach or if I'm missing something. Any help would be greatly appreciated.
Thanks in advance!
I'm having difficulty solving a SQL query question that I recently encountered online. I'm trying to write a query that will return the sum of all odd integers from 1 to 100, but I'm not sure how to go about it.
Here is the code I have so far:
SELECT SUM(column_name)
FROM table_name
WHERE column_name % 2 != 0;
I'm not sure if this is the correct approach or if I'm missing something. Any help would be greatly appreciated.
Thanks in advance!