question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comprison on NULL differes from SQL

See original GitHub issue

Hi,

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:open
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
piotr-m-bielskicommented, Oct 26, 2022

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

1reaction
mathiasrwcommented, Oct 17, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found