www.michalscorner.com what I have recently discovered

3Oct/110

python: install MySQL MSSQL Postgre database clients on debian

install MySQLdb

apt-get install python-mysqldb

install MSSQL

apt-get install python-pymssql

install PostgresQL

apt-get install python-psycopg2

19Jan/110

mysql: delete rows from table A if not exist in table B

delete from tableA where not exists (select * from tableB t1 where tableA.id = t1.id)

4Jan/110

set UTF8 encoding PHP and MySQL

MySQL settings - my.cnf
[mysqld]
character-set-server = utf8
default-character-set = utf8
skip-character-set-client-handshake

Right after mysql_connect execute before each query

mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");