Questions tagged [null]

Null means *nothing* or *unknown*, depending on context. Please use the "sql-null" tag for SQL specific questions.

"Null" has different meanings depending on context.

Set theory

Null is another name for the empty set, denoted by the symbol ∅. For this reason, some programming languages use null or nil for the empty list or empty tuple. Lisp uses nil to mean the empty list and the boolean value false.

Pointers and References

Null (or sometimes nil or None), in programming languages that support it, is the value of an uninitialized variable, a pointer that doesn't point to a meaningful memory address, or an object that fails to respond to any message.

Nullable references were invented by C.A.R. Hoare in 1965 as part of the Algol W language. Hoare later described his invention as a "billion-dollar mistake".

For more information, see Null pointer.

Agreeing with Hoare's sentiment, many languages don't have a special null value, choosing to use optional types instead.

Relational Databases

NULL as a special marker in SQL or a relational database stands in place of a value that is missing, or in a join means "no corresponding row." The operators IS NULL and IS NOT NULL are required for comparisons to a literal null: other comparisons between NULL and any value evaluate to "unknown."

For more information, see Null (SQL).

ASCII

Null or NUL is the name given to the character with ASCII code zero (0) - i.e. hex 00. In some languages, notably C, NUL is used to mark the end of a character string.

For more information, see Null character.

16208 questions
8
votes
0 answers

Python Pandas- Select rows where multiple columns are null

I want to select rows which have multiple columns(4 in the following example) as null values. I have used the following…
Ronith
  • 169
  • 2
  • 5
  • 12
8
votes
4 answers

F# Conditional Expressions if...then..else returning unit or ()

F#'s Condtional Expressions require a condition to check, a branch for true, and a branch for false. For example: let x = if ("hello" = null) then true else false //error if else branch missing However, something gets weird when unit,…
Brett Rowberry
  • 1,030
  • 8
  • 21
8
votes
7 answers

SQL Server Compare to NULL

I have a lot of comparisons that I need to make between a value and its previous value. For Example: ReceivedBy and PreviousReceivedBy. I started with: WHERE ReceivedBy != PreviousReceivedBy But if either value is null then this returns false,…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
8
votes
2 answers

Replace NULL in my Table with in PostgreSQL

Upon searching ways to replace NULL values in my table with 0 on Stack Overflow, it appears that many threads I've found point to using the COALESCE function. E.g. postgresql return 0 if returned value is null I understand that the COALESCE function…
ptk
  • 6,835
  • 14
  • 45
  • 91
8
votes
3 answers

Is it possible to ignore null values when using LEAD window function in Spark?

My dataframe like this id value date 1 100 2017 1 null 2016 1 20 2015 1 100 2014 I would like to get most recent previous value but ignoring null id value date recent value 1 100 2017 20 1 null 2016 …
John
  • 1,531
  • 6
  • 18
  • 30
8
votes
2 answers

Levels function returning NULL

I'm hoping this is an easy fix. Whenever I run levels(df) am I given a NULL output. This isn't specific to my data frame as it occurs with any set of data that I use. I am thinking that there may be an issue with one of my packages. Has anyone…
Wyatt
  • 83
  • 1
  • 1
  • 3
8
votes
3 answers

modelmapper null value skip

Class A { private String a; private String b; private B innerObject; } Class B { private String c; } In my case, String b might come in with a null value. My modelmapper configuration is like below: ModelMapper mapper = new…
AchuSai
  • 93
  • 1
  • 1
  • 6
8
votes
5 answers

PHP: Cast variable to null

I just stumbled upon a thing in the PHP manual that is new to me... Casting a variable to null will remove the variable and unset its value. (Source) Now I wonder how this can be done... I tried (null) and (NULL) but it seems to be interpreted as…
Paul
  • 2,972
  • 2
  • 21
  • 16
8
votes
2 answers

Detect null reference in an array

I want to detect whether or not a subrange of an array contains the null reference. Somehow like this: public static boolean containsNull (T[] array, int fromInclusive, int toExclusive) { for (int i = fromInclusive; i < toExclusive; ++i) …
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
8
votes
2 answers

Why is null stored as a string in localStorage?

In the Chrome console I set foo to null: localStorage.setItem("foo",null) Then I test, whether it is null: console.log(localStorage.getItem("foo")==null) prints false. Then I test, whether it is the string…
sbtpr
  • 541
  • 5
  • 18
8
votes
4 answers

Parsing dates in pandas.read_csv with null-value handling?

Consider the following made-up CSV: from io import StringIO data = """value,date 7,null 7,10/18/2008 621,(null)""" fake_file = StringIO(data) I want to read this file using pandas.read_csv, handling nulls with the na_values parameter and dates…
blacksite
  • 12,086
  • 10
  • 64
  • 109
8
votes
2 answers

Can an integer column be null?

I made an integer column that is null by default but when I put empty double quotes "" it gives this error: ERROR: invalid input syntax for integer: "" Does the integer column have to be 0 then? I am using Java to send the query to the database.
efoc
  • 593
  • 2
  • 10
  • 26
8
votes
6 answers

Can't send the value of null to MySQL database using Node.JS

I'm trying to send null to my MySQL database using Node.JS: con.query("INSERT INTO Routes (routeTrigger) VALUES ( " + null + " )", {title: 'test'}, function(err, result) { if (err) throw err; }); But when looking in the database, the updated…
djokerndthief
  • 455
  • 2
  • 4
  • 16
8
votes
2 answers

PDO Prepared Statements - NULLs

I have a delete query that I'm running, but just realized that this doesn't work when $user_id is null (which happens in certain cases). $id = 1; $user_id = null; $delete = $sql->prepare(" DELETE FROM `game_player` WHERE `id`…
Ian
  • 24,116
  • 22
  • 58
  • 96
8
votes
3 answers

Oracle Date Formatting Null date as 00/00/0000

How can I format the Null Dates in my Oracle SQL to 00/00/0000. I am using NVL function but it doesn't recognize the 00/00/0000 as the date format. Is there any Date Formatting available in Oracle SQL which formats null date to 00/00/0000
msbyuva
  • 3,467
  • 13
  • 63
  • 87