As written:

SELECT CONCAT(area, yearlevel, code) AS SubjectCode, Count(student)
FROM StudentTakesSubject
WHERE result < 50 AND result <> NULL
GROUP BY code
HAVING Count(Student) > 1;

This query should return no rows. Why? result <> NULL returns NULL as a boolean value (to a close approximation all comparisons to NULL return NULL). AND NULL evaluates NULL -- and NULL is not true. All rows are filtered out.

The NULL comparison is actually superfluous. The result < 50 will also filter out NULL values.

Looking at the rest of the query, you have another issue. The GROUP BY is on code. It should really be on SubjectCode -- the result of the CONCAT(). In fact, when concatenating different columns, I would recommend using a separator, say CONCAT_WS(':', area, yearlevel, code). Of course a separator may not be desirable for this particular situation.

Answer from Gordon Linoff on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_null_values.asp
SQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name WHERE column_name IS NOT NULL; Below is a selection from the Customers table used in the examples: The IS NULL operator is used to test for empty values (NULL values). The following SQL lists all customers with a NULL value in the "Address" field:
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_notnull.asp
SQL NOT NULL Constraint
String Functions: Asc Chr Concat ... SQL Training ... By default, a column can hold NULL values. The NOT NULL constraint enforces a column to NOT accept NULL values....
๐ŸŒ
Reddit
reddit.com โ€บ r/sql โ€บ question: is/is not null isn't working?
r/SQL on Reddit: Question: IS/IS NOT NULL isn't working?
June 10, 2019 -

I am working on a bunch of orders and I have an order date and the date that the order was "purchased". (The day we processed the order). If we never processed the order because the customer never followed through, there is a blank spot left in the purchased date resulting in a null when I run my query. I attempted to use IS NOT NULL to filter it out in the where statement but nothing happened. Any thoughts?

WHERE
DATE(a.ORDER_DATE) BETWEEN DATE(:startDate) AND DATE(:endDate)
AND
a.PURCH_ORDER_DATE IS NOT NULL;
Result of query

EDIT: For all of those who are wondering, I figured out how to sort out the null values.

SELECT DISTINCT
a.ORDER_NUMBER
,a.SALES_CATEGORY
,a.ORDER_DATE
,a.PURCH_ORDER_DATE
,CASE
    WHEN DATEDIFF(a.ORDER_DATE,a.PURCH_ORDER_DATE) >= 0 THEN DATEDIFF(a.ORDER_DATE,a.PURCH_ORDER_DATE)
    ELSE "null"
 END as Lag
FROM
SOBOOK a

WHERE
DATE(a.ORDER_DATE) BETWEEN DATE(:startDate) AND DATE(:endDate)
AND
ceil(DATEDIFF(a.ORDER_DATE,a.PURCH_ORDER_DATE)) = DATEDIFF(a.ORDER_DATE,a.PURCH_ORDER_DATE)

ORDER BY
 ORDER_NUMBER
,Lag
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ sql โ€บ is-not-null
SQL IS NOT NULL Condition: Syntax, Usage, and Examples
```sql SELECT * FROM users WHERE phone_number IS NOT NULL; ``` You can include `IS NOT NULL` alongside other filtering conditions with `AND` or `OR` operators. The `IS NOT NULL SQL` check ensures you're working with rows that contain real data and avoids processing empty or irrelevant fields.
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_ref_is_not_null.asp
SQL IS NOT NULL
SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Certificate SQL Training ... The IS NOT NULL command is used to test for non-empty values (NOT NULL values).
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ answers โ€บ questions โ€บ 4785170 โ€บ query-with-is-not-null-criteria-not-working
Query with "Is Not Null" Criteria not Working - Microsoft Q&A
My guess is that you had somehow set the database so that this field's Allow Zero Length string property (normally set to No) was set to Yes, and that you had "" - an empty string - in the field. This is not NULL and will fail these tests!
Find elsewhere
๐ŸŒ
Snowflake Documentation
docs.snowflake.com โ€บ en โ€บ sql-reference โ€บ functions โ€บ is-null
IS [ NOT ] NULL | Snowflake Documentation
The values in col1 are not NULL. The values in col2 are NULL. SELECT * FROM test_is_not_null WHERE col1 IS NOT NULL AND col2 IS NULL ORDER BY id;
๐ŸŒ
TechOnTheNet
techonthenet.com โ€บ sql_server โ€บ is_not_null.php
SQL Server: IS NOT NULL Condition
INSERT INTO contacts (contact_id, last_name, first_name) SELECT employee_id, last_name, first_name FROM employees WHERE last_name IS NOT NULL; This SQL Server IS NOT NULL example will insert records into the contacts table where the last_name does not contain a null value in the employees table.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ queries โ€บ is-null-transact-sql
IS NULL (Transact-SQL) - SQL Server | Microsoft Learn
To determine whether an expression is NULL, use IS NULL or IS NOT NULL instead of comparison operators (such as = or !=). Comparison operators return UNKNOWN when either or both arguments are NULL. The code samples in this article use the AdventureWorks2025 or AdventureWorksDW2025 sample database, which you can download from the Microsoft SQL Server Samples and Community Projects home page.
๐ŸŒ
ThoughtSpot
thoughtspot.com โ€บ sql-tutorial โ€บ sql-is-null
SQL IS NULL | Basic SQL | ThoughtSpot
3 weeks ago - This is covered in greater detail ... IS NULL OR TRIM(artist) = ''; WHERE artist = NULL will not workโ€”you can't perform arithmetic on null values....
๐ŸŒ
MSSQLTips
mssqltips.com โ€บ home โ€บ sql where is not null examples
SQL WHERE IS NOT NULL Examples
March 13, 2023 - The basic SQL syntax for creating a sample database to work with: ... Run the script above to create a test database if you do not have one already. ... USE myTestDataBase; GO IF OBJECT_ID('MyEmployeeTable') IS NOT NULL DROP TABLE MyEmployeeTable; GO CREATE TABLE MyEmployeeTable ( colID INT IDENTITY NOT NULL, firstName VARCHAR(20), lastName VARCHAR(20), hireDate DATE, email VARCHAR(50), promote VARCHAR(10) ); GO
๐ŸŒ
SQL Shack
sqlshack.com โ€บ working-with-sql-null-values
Working with SQL NULL values
May 19, 2021 - The reason for this issue is related to the structure of the SQL NULL because it does not specify an explicit value thus comparing an unknown value with an exact value result will be false.
๐ŸŒ
Quora
quora.com โ€บ What-is-the-SQL-IS-NOT-NULL-condition-and-how-is-it-used
What is the SQL IS NOT NULL condition and how is it used? - Quora
Answer (1 of 4): IS NULL and IS NOT NULL are substitutes for the โ€œ=โ€ sign. Equations are for stating that everything on the left side of the equation evaluates to the same thing as everything on the right side. But by definition the value of a NULL variable is unknown.
๐ŸŒ
Hightouch
hightouch.com โ€บ sql-dictionary โ€บ sql-is-not-null
SQL IS NOT NULL - Syntax, Use Cases, and Examples | Hightouch
December 29, 2023 - SELECT columns FROM table_name WHERE column_name IS NOT NULL; columns: The columns you want to retrieve in the query. table_name: The name of the table containing the data. column_name: The name of the column you want to filter based on whether ...
๐ŸŒ
DB Vis
dbvis.com โ€บ thetable โ€บ sql-is-not-null-condition-definitive-guide
SQL IS NOT NULL Condition: Definitive Guide
August 13, 2025 - IS NULL, as opposed to IS NOT NULL, is used to find records where a column explicitly contains a NULL value. In SQL, <> NULL and != NULL are equivalent, but neither works as expected because NULL represents an unknown value.
๐ŸŒ
TechOnTheNet
techonthenet.com โ€บ sql โ€บ is_not_null.php
SQL: IS NOT NULL Condition
The IS NOT NULL condition is used in SQL to test for a non-NULL value. It returns TRUE if a non-NULL value is found, otherwise it returns FALSE.
๐ŸŒ
Redgate Software
red-gate.com โ€บ home โ€บ learning & community โ€บ product learning โ€บ the โ€˜= nullโ€™ mistake and other sql null heresies
The '= NULL' Mistake and other SQL NULL Heresies | Redgate
June 17, 2019 - SQL Prompt has a code analysis rule (BP011) that checks whether a comparison or expression includes a NULL literal ('NULL'). These will always produce a NULL result. To determine whether a datatype is, or isnโ€™t, NULL, use IS NULL or IS NOT NULL. Beyond that, working with a nullable datatype in an expression requires use of the COALESCE(), ISNULL() or NULLIF() functions, as appropriate, to deal with NULL values safely.
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ isnull-not-working-1
ISNULL not working โ€“ SQLServerCentral Forums
November 19, 2013 - When the record of the column is blank. How can I deal this? Couple options. You can combine NULLIF, which returns null if two expressions have the same value or you can use a case statement to check for empty string or null. ... SELECT CASE WHEN @SomeValue IS NULL OR @SomeValue = '' THEN 'The ...