I have no proof to back this up, but I'd say that the first option would be the least resource heavy.
In the first example, the database returns the value of the field and you simply print it out.
In the second example, the database returns the value of the field, you then do comparisons and assignments on the returned value, and then print out the result.
The length of the data returned by the database is rather insignificant in these examples. A 10 character string will return in essentially the same time as a 1 character string.
Databases are designed for storing and retreiving information. Storing a much smaller amount of data will make the actual database file(s) smaller, but the added overhead of the comparison/assignment will decrease performance more.
Just my $0.02... Like I said, I have no proof to back this up, but this is how I imagine it would work out.
-Rich