Questions tagged [isnull]
The isnull tag has no usage guidance.
21
questions
1
vote
2
answers
121
views
PostgreSQL WHERE IS NULL causes bad query plan
I have a PostgreSQL table with the following schema and indexes
+---------+---------+-----------+----------+--------------+-------------+
| Column | Type | Modifiers | Storage | Stats target | ...
-1
votes
1
answer
224
views
Error while declaring procedure
When I run this query
it returns me a count of null values of the column country
(select
sum(case
when (country IS NULL) then 1
else 0 END)
as 'null_flag'
from city)
whereas ...
0
votes
1
answer
64
views
Improve this statement using ISNULL
Beginner with SQL and trying to improve this using ISNULL instead of the longer statement?
CASE WHEN c.FirstName IS NULL THEN '' ELSE c.FirstName END
1
vote
1
answer
33
views
Displaying null fields as 0 in mySQL select [duplicate]
I have a database that collects statistics from Usenet. When I do a basic select such as:
select day, count(day) from statistics where month = 12 and year = 2020 group by day;
I get the result
+------+...
-2
votes
1
answer
2k
views
Working with NULL Date Fields [closed]
I have a derived VARCHAR date field that I need to use for deriving another field, based off of whether or not the date field has a value. The derived date field is called "AmortDate" and I'm ...
-1
votes
1
answer
829
views
Problem with indexing null values
There is a table 'test' with ~ 10M records with field 'finish'.
select count(*) from test where finish is null;
count
---------
2485009
(1 row)
I'd like to create index to speed up queries like ...
2
votes
2
answers
65
views
Select IDS where all values can't be found in another table
Hey I'm pretty new to SQL and I've come up with a problem that I haven't been able to solve
I'm trying to make a query to bring up ID's that have ALL null values and are located in another table.
DB ...
-4
votes
1
answer
32
views
How to list not nullable unique column list in postgres DB? [closed]
I want the list of unique columns with not null constraint
-1
votes
1
answer
62
views
Replace NULLs with value
Here is my temporary table:
CREATE TABLE #test123(
c1 float,
c2 float,
c3 float,
c4 float,
c5 float
);
INSERT #test123(c1,c2,c3,c4,c5)
VALUES (2,3,NULL,1,2),
(2,NULL,NULL,...
4
votes
2
answers
282
views
Extract rows of a table, that include less than x NULLs [duplicate]
I am working with a SQL Server database, which includes a lot of NULLs.
To analyse my data, I want to extract all rows of the database table, that include less than x NULL marks (e.g. x=2).
My ...
1
vote
1
answer
1k
views
Try_Convert Datetime showing '1/1/1900', want to show space
How do I get try_convert datetime to display NULL when the input is space?
I am getting two different results here. My intention is to show 'space' number query as Null also, just like first query.
...
0
votes
1
answer
1k
views
Display all fields with null values in a particular row in SQL Server
I have a requirement where I want to fetch and display all the fields with NULL value for a particular row in the table.
Some thing like:
select 'all columns with NULL'
from table_xyz
where ...
1
vote
2
answers
6k
views
Remove all Null values from Sql table at once
I am very new to Teradata and SQL environment. I am trying to remove all the null values from sql table in teradata using
ISNULL(COLUMNNAME,0). But it gives an error that "the data type does not match ...
2
votes
1
answer
468
views
Where NULL IS NULL
I'm seeing a lot of where NULL IS NULL type conditions in code and I'm curious about the overhead that may be involved in this.
So given SELECT * FROM table WHERE field = 'TERM' AND (NULL IS NULL OR ...
7
votes
2
answers
7k
views
Count NULL values per row
I would like to count the number of null's present per row in a table without enumerating column names. For example:
WITH t as (VALUES
(NULL ,'hi',2,NULL,'null'),
('' ,'hi',2,3,'test'),
(NULL ,'...
0
votes
1
answer
2k
views
case when IsNull Alternatives?
Is there a way, to optimize this query, where several IsNull in relation with dates are used? Unfortunately the query is a way slow and actually I have no glue, how to make it way faster.
case
when ...
3
votes
2
answers
876
views
Avoiding null comparisons in where clause
It's my impression that comparing to null limits the use of an index. We had a DBA come in and that statement was part of his notes, however no better example was given.
If that statement is true, ...
1
vote
1
answer
550
views
Difference in efficiency between NVL and IS NULL
I have the below query (showing the last part of the query). In the first example I get a result (which is not exactly as desired) but the results arrive within 10min. The second version results in an ...
2
votes
1
answer
2k
views
Addition With Null Values
I have inherited a table that has NULL values for float fields, instead of a 0 value. I am doing some basic testing for querying, and in my tests both ISNULL() and COALESCE() present the same ...
0
votes
2
answers
536
views
How can I replace the following query with ISNULL function in SQL?
I have the following query. For performance optimization reasons I have been asked to replace the logic with ISNULL function in SQL. How can I achieve this? please advice.
SELECT ...
1
vote
3
answers
4k
views
Matching 3 columns in row - if one column is null then exclude it from comparison
A B C Equal
1 1 1 Y
2 2 NULL N
Hi, I have 3 columns which I need to compare : Columns A,B,C.
If these 3 columns are the same then column 'Equal' = 'Y'
But, if a column is null, ...