ok so i have an SQL query. but i want to put null where there is no data how do i do this.
8 Replies - 1021 Views - Last Post: 10 April 2012 - 08:33 AM
#1
how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 06:38 AM
Replies To: how do i put null in the SQL query where there is no data?
#2
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 06:45 AM
First your column needs allow nulls.
Then you just do something like:
What does your query look like?
Then you just do something like:
update <table name> set <column name> = null where <condition>
What does your query look like?
#3
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:05 AM
SELECT *
FROM bands
left join band_members
on band_members.band_id = bands.band_id
what is my table name. as it's a query.
FROM bands
left join band_members
on band_members.band_id = bands.band_id
what is my table name. as it's a query.
#4
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:10 AM
Oh.. you are doing a join? Well that's a bit different. Left join should provide nulls where there is data in the left table and not in the right.
Where do you exactly want the nulls to be?
Where do you exactly want the nulls to be?
#5
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:17 AM
i want the nulls to be where there is no data... right now they are just blank.
my assignment question is: Use a left outer join to list all band_ids, band_names and their members details. If they have no members listed in the band_members relation then the band_id and band_name
should still be listed but with null values for the band members details.
"null values" does that mean if there is no data then "null" should be displayed.
or does it mean blank space.
my assignment question is: Use a left outer join to list all band_ids, band_names and their members details. If they have no members listed in the band_members relation then the band_id and band_name
should still be listed but with null values for the band members details.
"null values" does that mean if there is no data then "null" should be displayed.
or does it mean blank space.
#6
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:26 AM
What database are you using? MSSQL should provide nulls in the cells that don't have matching data.
#7
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:27 AM
i am using SQLite database browser
#8
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:31 AM
That makes some sense. SQLlite tends to show, what everyone else would call a null, as a blank space.
#9
Re: how do i put null in the SQL query where there is no data?
Posted 10 April 2012 - 08:33 AM
lol so i have answered the questions... thanks guys!!!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|