Blog Archives

MYSQL conditional statement example (case when then)

MYSQL has very powerful set of control flow/conditional features, and case/when/then is one of these. Assume that you need a table to store a generic value, with different value types, and for the sake of demo, let’s keep it simple.

Tagged with: , , , , ,
Posted in database, MyBatis

How to backup and restore mysql DB

Here are a couple of simple mysql commands to backup and restore mysql database 1. backup mysqldump -u [username] -p[pass] -h [hostname] -P [port] [database name] > [database name].sql the -h and -P can be omitted if using localhost and

Tagged with: , ,
Posted in database

How to replace string with ms sql

From time to time, you may get request from client to update content in a web site, by replacing one specific string with another. If the site has a cms capability, you may use that to do the update. But

Tagged with: , , ,
Posted in database

update an existing table with excel sheet

If you maintain an existing web site for a client, and a lot of times, client wants to update information which resides in a table. For example, we have a list of retail stores with address information which resides in

Tagged with: , ,
Posted in database