December 3, 2008

SQL: Insert data to multiple tables?

Filed under: PHP, SQL — Tags: , , , , , — hoball @ 2:16 pm

By the help of

mysqli_insert_id() in MySQLi extension


PDO->lastInsertId() in PDO

Reference: http://www.desilva.biz/mysql/insertid.html


October 18, 2008


Filed under: SQL — Tags: , — hoball @ 9:21 pm


July 30, 2008

MySQL Import large database using commands

Filed under: SQL — Tags: , , , , — hoball @ 11:50 am

If you have a very large database, it is frustrating to restore/import it using HTTP as most probably there are transfer limit.
So, it is time to use the command prompt. Firstly, upload the sql file to an easily accessed folder(Windows/Linux). Then run the command:

mysql -u xxx -p -h SERVER_PATH DATABASE_NAME < file.sql

If the database is not created, you can create it first, by using:

CREATE DATABASE database_name;

July 23, 2008

MySQL – Show Tables in a Database

Filed under: SQL — Tags: , , — hoball @ 2:17 pm

To show all the tables in a selected database (currently working):


To show all the tables in ANOTHER database:

SHOW TABLES IN other_database;

To show a table who you forget the exact name, you may use the wildcard(%):

SHOW TABLES IN other_database LIKE “%salary%;

Blog at WordPress.com.