When you send a query to MySQL, you usually don’t need to think
explicitly about the types of the expressions in your query. If
you compare this to a lot of programming languages, you’ll find
that it’s not always the way things work. In strongly typed
languages like Java, for example, typing is very strict.
In this respect, MySQL is much more like a dynamically typed
language such as PHP or Perl — a DWIM (do what I mean) typing
system. Yet, internally, every expression in MySQL has a type,
and it does conversions amongst them as needed.
Sometimes, you might wonder how does this query work and
exactly what’s happening to the variables in these
expressions? Importantly, does it always work right?
Examples of MySQL Type Conversion
Let’s look at MySQL in action and see if we can figure out how
it’s handling expression types. I’ll start with a simple example:
it’s actually possible to add a …
[Read more]