0

Hi everyone,
Thanks for viewing this post.

I have a question about SQL. May i know how to remove rows that have NULL value in one of the colums.

SELECT name, grade, age FROM education

If let say grade 1 of the rows is NULL, how do i remove that particular rows?
Please guide me thanks.

4
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by crishlay
0

I have tried doing WHERE clause

SELECT name, grade, age FROM education
WHERE grade IS NOT NULL

It didnot work.

0

That should work, ensure that you are using where clause on the proper column.

Also check if the column contains any white spaces.

0

first select whether your table has null rows or not.
run following queries one by one.

SELECT name, grade, age FROM education 
WHERE (grade IS  NULL )

SELECT name, grade, age FROM education 
WHERE ( name is null )

SELECT name, grade, age FROM education 
WHERE (age is null)

see whether you get any row(s) (having null value)

Edited by urtrivedi: n/a

0

I did what you say. and run the query. the result is NONE.

so do you mean that i don't have any NULL value at all?

the result out before it was, there are cells that indicate NULL. how do i actually remove that particular rows?

Edited by strRusty_gal: n/a

0

i think you do not have null vales in your database. What you have is 'NULL' word in columns, thats why my query did not show any result.

So now you can remove such rows by following query

delete from tablename where TRIM(grade)='NULL'
0

Hi,
Thanks for everyone help. I have solved the matter by placing another table. Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.