Home PHP, MySQL, Javascript, CSS and Ajax Interview Questions and Answer PHP, MySQL, Javascript, CSS and Ajax Interview Questions and Answer Part – 4

PHP, MySQL, Javascript, CSS and Ajax Interview Questions and Answer Part – 4

PHP, MySQL, Javascript, CSS and Ajax Interview Questions and Answer Part – 4

31. Short Open Tags in PHP

Using Short Open Tags < ? displays php code in the page itself. So we need to turn on Short Open Tag in php.ini and restart the service
short_open_tag=On

32. How to insert large files in Mysql DB ?

The server’s Maximum allowed packet size default’s to 1MB. So you can increase this if the server needs to handle big queries (for example, if you are working with big BLOB columns). For example, to set the variable to 16MB, start the server like this:
shell> mysql –max_allowed_packet=16M
You can also use an option file to set max_allowed_packet.
max_allowed_packet=16M

33. Types of Tables in MySQL

There are two different types of tables in mysql
Transaction Safe Tables:
This table allows to recover lost data.
Non Transaction Safe Tables:
This table requires less memory and are much faster. But changes made are permanent.

34. Types of Storage Engine in MySQL?

There are five main types of storage engines to store and update data. Below are different types of storage engine
MyISAM:

Default storage and supports Non Transaction Safe Tables.
MERGE:

This supports Non Transaction Safe Tables.
HEAP:
InnoDB:

This don’t support auto-increment and blob/text.
BDB:

This supports Transaction Safe Tables and supports very large application.

35. MYSQL Commands

CREATE:

Create new database and table.
ALTER:

Modify the existing table.(Ex. modifying datatype,Fieldname….)
SELECT:

Retrieves record you want.
DELETE:

Deletes record.
DESCRIBE:

Describes the structure of table.
INSERT:

Add new values in to the table.
UPDATE:

Modify the existing record data.
DROP:

Deletes entire table or database

36. Syntax for CREATE command in Mysql

Create statement is used for creating Database and Table
CREATE DATABASE [database_name ];
Following example shows how to create database from php file using mysql_query() function.
< ?php
$db_connect = mysql_connect(“localhost”,”root”,””);
if ($db_connect ) {
mysql_query(“CREATE DATABASE master_detail”,$db_connect);
}
else{
echo “Can’t able to Connect database”;
}
mysql_close($db_connect);
?>

CREATE TABLE table_name (column_name column_type);
< ?php
$db_connect = mysql_connect(“localhost”,”root”,””);
if ($db_connect ) {
mysql_query(“CREATE DATABASE master_detail”,$db_connect);
mysql_select_db(“master_detail”, $db_connect);
$query = “CREATE TABLE (personal_detail Name varchar(15), Age int)”;
mysql_query($query,$db_connect);
}
else{
echo “Can’t able to Connect database”;
}
mysql_close($db_connect);
?>

37. Types of Storage Engines in MySQL

Types of storage engine in MySQL
1. MyISAM (default)
2. Heap
3. Merge
4. INNO DB
5. ISAM

38. Differences between DROP a table and TRUNCATE a table?

TRUNCATE : This will delete the table but not the structure.

DROP: This will delete the table structure and its data.

Leave a Comment