Questions tagged as 'null'

1
answer

Why should we use "IS NOT NULL" instead of "NULL"?

I always asked myself this: Why should we use IS NOT NULL instead of <> NULL ? For when I do as in the second case, no result is found. Example: SELECT * FROM tabela WHERE campo IS NOT NULL Displays all rows, except wh...
asked by 18.08.2015 / 22:24
3
answers

How to handle NullReferenceException with Lambda

I have a class to search for DisplayName of my entities, where I pass the entity and class returns a list with the actual values and name of each entity attribute. My problem is when I search, and some attribute in the entity does not...
asked by 25.04.2017 / 03:43
2
answers

What is the difference between an empty string and NULL in SQL?

What's the difference if you store a string as NULL or empty in SQL? How can these two behave when I make a SELECT , or INSERT with value '' in that column that is of type varchar ? If I leave the de...
asked by 13.01.2017 / 15:58
1
answer

If the field has DEFAULT should it be NOT NULL?

Situation I was adding a few more columns to a table and fell out of this thought. By default we leave all fields with NULL value, however if it has a DEFAULT it will insert DEFAULT instead of NULL . Question...
asked by 20.10.2015 / 17:12
4
answers

Null values in PHP

In PHP 7 what is the correct way to define and identify null values? Which of these is the correct way to assign null? $valor = null; $valor = ""; Which of these is the correct way to identify null values? if($valor == null){} if($va...
asked by 20.09.2017 / 15:34
2
answers

Is the following database modeling in my head?

I created this modeling (just an idea), so that it does not have null / white fields. I have not completely revised it. There may be fields that would be blank. The matrix table was Entities and through the needs of there being no blank field...
asked by 30.06.2016 / 20:42
4
answers

Constructing SQL tables - using or not fields with Not Null?

I am having a question regarding the construction of tables and the use of Not Null field. I know that for fields of Primary Key , it must be Not Null , but in other fields, what is the need to use Not Null ? so I und...
asked by 11.08.2016 / 13:26
2
answers

How to convert a nullable int to common int

I have a method that receives an integer that can be null , in case some method executions happen, but when I use this same variable in a place that uses int that can not be null, it appears that the overload is incorrect....
asked by 15.05.2017 / 19:51
2
answers

The operator! = is undefined for the argument type (s)

I am trying to create a method to save users in the database by doing the following check if the id of the last user is different from null it changes if it does not register. Code public void salvar(Usuario usuario){...
asked by 28.03.2016 / 20:48
3
answers

In PHP, is NULL a constant or a keyword?

In PHP, is NULL a constant or a keyword? I've heard that it's a constant, but it seems like the behavior of PHP keywords (which are not case-sensitive)? Example: echo NULL; echo null; exit('teste'); EXIT('teste');     
asked by 15.07.2015 / 16:25