Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialct7
Courses Plus Student 964 PointsConcatenate empty data
Hi,
How do I write my query if I'm using concatenation with two columns, say for instance, first_name and last_name, and there are empty cells for some last_name?
Thanks
1 Answer
KRIS NIKOLAISEN
54,971 PointsThey'll just be empty unless you want to filter or replace the empty value somehow
ct7
Courses Plus Student 964 PointsHi Thanks for your response. When I tried it came back with both empty, even though there was a first name.
KRIS NIKOLAISEN
54,971 PointsKRIS NIKOLAISEN
54,971 PointsAre you talking about empty or null? If null the default behavior is to return null when concatenating values (depending on the data engine and settings used).
I just tried in the playground and found this to be the case. Open the playground for the video and run the following
The first select returns null for the concatenated fields
The update statement updates null last_names to empty
The second select returns the first name and an empty string for the concatenated fields