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 trial

Databases

Michael Bishara
Michael Bishara
1,911 Points

How do you write a value that is in a specific column inside a function?

UPPER( <value or column>) is the example in the SQL videos.

I know how to put in a column, we just write the column name. But what if I want to put in a value that is in a specific column?

For example, within 2 columns contains the value "Michael". I want to show the USERNAME as MICHAEL and the first_name as Michael.

If I try UPPER("Michael") , wouldn't both become uppercase?

EDIT

Let me try another example:

SELECT REPLACE(Michaelm.tablename1 , "m", "M") FROM users;

I want to select Michaelm from tablename1 not tablename2, how do I choose specifically tablename1 with a value?

1 Answer

Hi Michael,

If I understand your question I think you want to return a specific row from a table?

You should be able to add a WHERE clause to the end of your query to get back the row with "Michael" in it.

Something like this

WHERE Michaelm.tablename1 = "Michael"

Let me know if I've misunderstood what you're trying to do.