Reputation: 77
How can I quickly check to see if the data from the test table 'test_table', and selected columns are unique and not null.
Summary, at the entrance gets a table name and a list of columns in the output are expected , eg . flag 1 or 0.
Table is big so unfortunately i must posibly fast execute;
Upvotes: 0
Views: 121
Reputation: 77
SELECT 1
FROM dual
WHERE EXISTS
(SELECT a, b FROM tab WHERE id=1
AND name='John'
AND (a IS NULL OR b IS NULL))
I changed your code and I have one question about it , now I have is that id must be 1 and the name 'John ' and any of verifying null must be correct, and wants to have that must be id = 1 and the name 'John ' and if there is either the value of the column is ' null'
Upvotes: 1
Reputation: 40481
select 1 from dual
where exsist (select col1,col2,col3,... from table
where col1 is not null and col2 is not null and col3....
group by col1,col2,col3.. having count(*) > 1 )
this will return 1 when one of the is true.
Upvotes: 1