Set - 5

Question 11 :

What is the functionality of MD5 function in PHP? 

Answer :

string md5(string)
It calculates the MD5 hash of a string. The hash is a 32-character hexadecimal number.


Question 12 :

How can I load data from a text file into a table? 

Answer :

The MySQL provides a LOAD DATA INFILE command. You can load data from a file. Great tool but you need to make sure that:

a) Data must be delimited
b) Data fields must match table columns correctly


Question 13 :

How can we know the number of days between two given dates using MySQL?

Answer :

Use DATEDIFF()
SELECT DATEDIFF(NOW(),'2006-07-01');

 


Question 14 :

How can we change the name of a column of a table?

Answer :

This will change the name of column:

ALTER TABLE table_name CHANGE old_colm_name new_colm_name

 


Question 15 :

How can we change the data type of a column of a table? 

Answer :

This will change the data type of a column:

ALTER TABLE table_name CHANGE colm_name same_colm_name [new data type]