Posts Tagged with "mysql"
Meet AMPPS - a good alternative for XAMPP and WAMP
Posted by Stanislav Furman on October 7, 2013Concatenating NULL and blank fields in MySQL
Posted by Stanislav Furman on May 17, 2013If you ever need to concatenate fields that are empty or equal null, you may run into troubles because MySQL doesn't concatenate NULL-fields as you might expect - if there is one of the concatenating fields equals NULL, the whole concatenating value will be NULL.
See the following dummy table:
firstname | middlename | lastname | email
John J. Smith [email protected]
Amanda NULL Smith [email protected]
As you can see Amanda Smith doesn't have middle name. So, if you now run a query that will try to concatenate first name, middle name and last name, you'll get NULL value instead of expected concatenated value.
Continue readingMySQL. How to insert a row or update if exists in MySQL.
Posted by Stanislav Furman on February 25, 2013Being a web developer, I personally like short solutions, and when I code, I try to write as less code as possible. At the same time the code has to be readable for other developers without using comments.
If you want to combine create/update function into one, MySQL offers you a very useful statement : INSERT ... ON DUPLICATE KEY UPDATE.
Continue reading