Archive for the ‘ MySql Interview Questions ’ Category
How Can I Retrieve Values from One Database Server and Store them in Other Database Server Using PHP?
on March 3, 2010
We can always fetch from one database and rewrite to another. Here is a very simple solution. $db1 = mysql_connect("hostname","username","password") // Connect to Server 1 mysql_select_db("db1″, $db1); $res1 = mysql_query("query",$db1); $db2 = mysql_connect("hostname","username","password"); // Connect to Server 2 mysql_select_db("db2″, $db2); $res2 = mysql_query("query",$db2); At this point you can only fetch records from your previous ResultSet, i.e $res1 – But you cannot execute new …
Explain the difference Among FLOAT, DOUBLE and REAL
on March 2, 2010
FLOATs store floating point numbers with 8 place accuracy and take up 4 bytes. DOUBLEs store floating point numbers with 16 place accuracy and take up 8 bytes. REAL is a synonym of FLOAT for now.
What is Meant by Persistent Database Connection?
on February 23, 2010
Persistent connections are links that do not close when the execution of your script ends. When a persistent connection is requested, PHP checks if there’s already an identical persistent connection (that remained open from earlier) – and if it exists, it uses it. If it does not exist, it creates the link. An ‘identical’ connection is a connection that was opened to the …
UK Postcodes Complete Database Table – Import and Enjoy
on February 19, 2010
1. Download this file and import it into your database. Postcodes.txt 2. Rename Postcode.txt to Postcode.sql 3. Import to your database and enjoy complete list of UK Postcodes. Here is the sample code: CREATE TABLE IF NOT EXISTS `postcodes` ( `id` int(11) NOT NULL auto_increment, `postcode` tinytext NOT NULL, `grid_n` varchar(15) NOT NULL, `grid_e` varchar(15) NOT NULL, `latitude` varchar(15) NOT NULL, `longitude` varchar(15) …
How to Connect to MySQL Database Using PHP?
on February 17, 2010
<?php $username = "your_name"; $password = "your password"; $hostname = "localhost"; $dbname = "database name"; //Connection to the MySql Database $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); mysql_select_db("$dbname",$db); echo "Connected to MySQL"; ?>
What Is the Difference Between Mysql_Connect() and Mysql_Pconnect()?
on February 16, 2010
When they are using mysql_connect() function, every time it is opening and closing the database connection, depending on the request . mysql_connect() and mysql_pconnect() both are working for database connection but with small difference. In mysql_pconnect(), ‘p’ stands for persistence connection. But in case of mysql_pconnect() function, first, when connecting, the function would try to find a (persistent) connection that’s already open with …
MySQL Optimization
on February 4, 2010
myisamchk is used to get information about your database tables or to check, repair, or optimize them. This command can check or repair MyISAM tables. It can also optimize and analyze these tables. Database design, tuning of databases can be used to improve and optimize performance of MySql. Indexes should be used to increase the performance of MySQl select query. Index on a …
What is the default table in MYSQL?
on December 16, 2009
What is the default table in MYSQL and which type of table is generatedby default. MyISAM is the default storage engine.
What is maximum size of a database in MySQL?
on December 2, 2009
If the operating system or filesystem places a limit on the number of files in a directory, MySQL is bound by that constraint.The efficiency of the operating system in handling large numbers of files in a directory can place a practical limit on the number of tables in a database. If the time required to open a file in the directory increases significantly …
Please explain .frm .myd .myi in mysql?
on November 2, 2009
Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. The ‘.frm’ file stores the table definition. The data file has a ‘.MYD’ (MYData) extension. The index file has a ‘.MYI’ (MYIndex) extension.

