From the course: MySQL Essential Training
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
String concatenation - MySQL Tutorial
From the course: MySQL Essential Training
String concatenation
- [Bill] Hi, I'm Bill Weinman. MySQL uses the standard SQL concatenation operator for a different purpose. The SQL standard uses two vertical bar characters for string concatenation like this: Select string1 and two vertical bars, and then string2. And when I execute this in MySQL, you notice that I do not get two concatenated strings, instead I get a logical false. That's because this operator is not string concatenation in MySQL. In fact, it is the logical OR operator. So if I say TRUE, and then the logical OR operator and FALSE, I get TRUE as a result. because this operator in MySQL is not string concatenation, it is logical OR. MySQL also has a spelled out OR operator, which looks like this and does exactly the same thing. But if you want string concatenation, you need to use the CONCAT function. And so I can do this with string1 and string2. And execute that, and I get the strings concatenated into one string. MySQL's use of the standard concatenation operator for another purpose…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.