.zero

★ ★ ★
Aug 8, 2006
83,341
What am I doing right now?

I set a record of not having a bowel movement in 10 days...that coupled with the permanent diarrhea I decided to sit on the bowl and throw a Juventus flag in the bowl along with an over rated Del Piero poster and took what is the most massive dump in the history of dumps...


Burp
:lol:

Wonderful drop-in cameo
 

Dostoevsky

Tzu
Administrator
May 27, 2007
89,187
@Martin

SELECT CustomerName, Address+', '+City+', '+PostalCode+', '+Country AS Address
FROM Customers;

I understand what this does. What I don't understand is why the bold parts. I mean, why that order (starting +' and ending '+)? I don't think I've seen the explanation for it before.
 

Martin

Senior Member
Dec 31, 2000
56,913
@Martin

SELECT CustomerName, Address+', '+City+', '+PostalCode+', '+Country AS Address
FROM Customers;

I understand what this does. What I don't understand is why the bold parts. I mean, why that order (starting +' and ending '+)? I don't think I've seen the explanation for it before.
So this would be on a table that looks like this:

Code:
--------------------------------------------------------
| CustomerName | Address | City | PostalCode | Country |
--------------------------------------------------------
| Bob          | at home | Roma | 234234     | Italy   |
| Frank        | at work | Roma | 45644      | France  |
--------------------------------------------------------
The result of that select would be:

Code:
--------------------------------------------------------
| CustomerName | Address                               |
--------------------------------------------------------
| Bob          | at home, Roma, 234234, Italy          |
| Frank        | at work, Roma, 45644, France          |
--------------------------------------------------------
So from a table with 5 columns you're returning two columns of values, the first being CustomerName just as its stored, the second being a combination of the other 4.

Is that clear?
 

swag

L'autista
Administrator
Sep 23, 2003
84,905
What am I doing right now?

I set a record of not having a bowel movement in 10 days...that coupled with the permanent diarrhea I decided to sit on the bowl and throw a Juventus flag in the bowl along with an over rated Del Piero poster and took what is the most massive dump in the history of dumps...


Burp
Nick! You poor-man's Christian-Vieri-looking anal hairball! How you been?

@Martin

SELECT CustomerName, Address+', '+City+', '+PostalCode+', '+Country AS Address
FROM Customers;

I understand what this does. What I don't understand is why the bold parts. I mean, why that order (starting +' and ending '+)? I don't think I've seen the explanation for it before.
Bobby Tables :touched:
 

Dostoevsky

Tzu
Administrator
May 27, 2007
89,187
So this would be on a table that looks like this:

Code:
--------------------------------------------------------
| CustomerName | Address | City | PostalCode | Country |
--------------------------------------------------------
| Bob          | at home | Roma | 234234     | Italy   |
| Frank        | at work | Roma | 45644      | France  |
--------------------------------------------------------
The result of that select would be:

Code:
--------------------------------------------------------
| CustomerName | Address                               |
--------------------------------------------------------
| Bob          | at home, Roma, 234234, Italy          |
| Frank        | at work, Roma, 45644, France          |
--------------------------------------------------------
So from a table with 5 columns you're returning two columns of values, the first being CustomerName just as its stored, the second being a combination of the other 4.

Is that clear?
It is clear. That does make sense.

I just don't know why is is written like this +'. This
 

Attachments

Martin

Senior Member
Dec 31, 2000
56,913
It is clear. That does make sense.

I just don't know why is is written like this +'. This
I don't know how many concepts you've learned already.

In programming there is a basic concept called a string. It means a sequence of characters.

"a" is a character
"abc" is a string (more than one character)

In the SELECT you showed there are several strings being concatenated (ie. glued together) using the + sign (which means "joing two strings into one string").

So:

"a" + "b" => "ab"

- - - Updated - - -

I'll tell you later :D
 

Dostoevsky

Tzu
Administrator
May 27, 2007
89,187
I don't know how many concepts you've learned already.

In programming there is a basic concept called a string. It means a sequence of characters.

"a" is a character
"abc" is a string (more than one character)

In the SELECT you showed there are several strings being concatenated (ie. glued together) using the + sign (which means "joing two strings into one string").

So:

"a" + "b" => "ab"
This post made me feel like a retard. :D

Thanks.

Nick! You poor-man's Christian-Vieri-looking anal hairball! How you been?


Bobby Tables :touched:
Hey, I'm just trying to expand the universe of not-knowing. :p
 

Users Who Are Viewing This Thread (Users: 0, Guests: 370)