Comprison on NULL differes from SQL
See original GitHub issueHi,
We have noticed that the result of the following example doesn’t return the expected result (based on https://doi.org/10.14778/3151113.3151116)
alasql('CREATE TABLE R (a number)');
alasql('CREATE TABLE S (b number)');
alasql.tables.R.data = [ {a: 1}, {a: null} ];
alasql.tables.S.data = [ {b: null} ];
var res = alasql('select a from R where a not in (select b from S)');
// expected: res = []
// alasql: res = [ {"a": 1} ]
See https://jsfiddle.net/3ya794kr/.
This query compares each row of R
with NULL
which always returns unknown
in SQL. Since not in unknown
is unknown
, the result should be the empty collection.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
How to Use Comparison Operators with NULLs in SQL
To handle NULLs correctly, SQL provides two special comparison operators: IS NULL and IS NOT NULL. They return only true or false and...
Read more >SQL Server IS NULL Operator - UpScale Analytics
In SQL Server, NULL value indicates an unavailable or unassigned value. The value NULL does not equal zero (0), nor does it equal...
Read more >SQL's NULL values: comparing, sorting, converting ... - SILOTA
SQL's NULL values: comparing, sorting, converting and joining with real values. SQL's NULL value is a major point of confusion. The premise of...
Read more >How to compare Null values from the database column
As per my SQL Knowledge u can store NULL in a variable, but can't use it for comparing update emp set name="gaurav" where...
Read more >SQL NULL Values - IS NULL and IS NOT NULL - W3Schools
Note: A NULL value is different from a zero value or a field that contains spaces. A field with a NULL value is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried to do that, but It is really hard to understand how it works. (parser) Variables like yy do not help. I will try again over this weekend
Oh - we can work on a solution. So you can just start on this. But before the release we will discuss how to let the users configure this. How we do that depends on what the solution looks like. So I suggest you work on solving this, and then we talk about how the solution can be part of what Alasql offers.