sql for tables in mysql and now in postgresql