0

I want to replace all NULL value by nothing('') in an output query.

Note: I don't want to replace the NULL by nothing in the table.

SELECT row1, row2, row3
ISNULL(row1,'') AS row1
FROM table

output error:

Result: near "(": syntax error

Someone have an idea about the right syntax?

Thanks in advance,

1

ISNULL is not in the sqlite vocabulary. You might find the CASE expression useful.

9
  • Thanks again for your answer. I'm felling in a smal box without all python and SQL library.
    – saquiel
    Jan 30 '20 at 17:29
  • 1
    FWIW ISNULL is (if I recall) Sql Server syntax, so even if you were using the python Sqlite API (instead of cs50 SQL) it wouldn't be available. Jan 30 '20 at 18:03
  • 1
    I'm a big fan of python's sqlite3 API but maybe that's because i cut my teeth on php/sqlite3 and it's comfortably similar. I've never used SQLAlchemy, but a lot of people do. IMO learning the foundation tech (eg python/sqlite3 library) should come before learning the abstraction layer (SQLAlch). Jan 30 '20 at 19:55
  • 1
    re: ISNULL, you could also try the COALESCE function, easier to type, easier to read :) Jan 31 '20 at 16:14
  • 1
    Here is a reference of SQL null functions in different SQL flavors. ISNULL is not a Sqlite function. Feb 3 '20 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .