1.What is the functionality of MD5 function in PHP?
Ans: string md5(string) .It calculates the MD5 hash of a string. The hash is a 32-character hexadecimal number.
2.Will comparison of string “10″ and integer 11 work in PHP?
Ans: Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
3.What’s the difference between accessing a class method via -> and via ::?
Ans: :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.
4.How can I load data from a text file into a table?
Ans: 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
5.How can we know the number of days between two given dates using MySQL?
Ans: Use DATEDIFF()
SELECT DATEDIFF(NOW(),’2006-07-01′);
6.How can we change the name of a column of a table?
Ans: This will change the name of column:
ALTER TABLE table_name CHANGE old_colm_name new_colm_name
7.How can we change the data type of a column of a table?
Ans: This will change the data type of a column:
ALTER TABLE table_name CHANGE colm_name same_colm_name [new data type]
8.What is the difference between GROUP BY and ORDER BY in SQL?
Ans: To sort a result, use an ORDER BY clause.
The most general way to satisfy a GROUP BY clause is to scan the whole table and create a new temporary table where all rows from each group are consecutive, and then use this temporary table to discover groups and apply aggregate functions (if any).
ORDER BY [col1],[col2],…[coln]; Tells DBMS according to what columns it should sort the result. If two rows will have the same value in col1 it will try to sort them according to col2 and so on. GROUP BY [col1],[col2],…[coln]; Tells DBMS to group (aggregate) results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average.
9.What are the MySQL database files stored in system ?
Ans: Data is stored in name.myd
Table structure is stored in name.frm
Index is stored in name.myi
10.How can we encrypt and decrypt a data presented in a table using MySQL?
Ans: You can use functions: AES_ENCRYPT() and AES_DECRYPT() like:
AES_ENCRYPT(str, key_str)
AES_DECRYPT(crypt_str, key_str)
11.What is the difference between htmlentities() and htmlspecialchars()?
Ans: htmlspecialchars() – Convert some special characters to HTML entities (Only the most widely used)
htmlentities() – Convert ALL special characters to HTML entities
Ans: string md5(string) .It calculates the MD5 hash of a string. The hash is a 32-character hexadecimal number.
2.Will comparison of string “10″ and integer 11 work in PHP?
Ans: Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
3.What’s the difference between accessing a class method via -> and via ::?
Ans: :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.
4.How can I load data from a text file into a table?
Ans: 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
5.How can we know the number of days between two given dates using MySQL?
Ans: Use DATEDIFF()
SELECT DATEDIFF(NOW(),’2006-07-01′);
6.How can we change the name of a column of a table?
Ans: This will change the name of column:
ALTER TABLE table_name CHANGE old_colm_name new_colm_name
7.How can we change the data type of a column of a table?
Ans: This will change the data type of a column:
ALTER TABLE table_name CHANGE colm_name same_colm_name [new data type]
8.What is the difference between GROUP BY and ORDER BY in SQL?
Ans: To sort a result, use an ORDER BY clause.
The most general way to satisfy a GROUP BY clause is to scan the whole table and create a new temporary table where all rows from each group are consecutive, and then use this temporary table to discover groups and apply aggregate functions (if any).
ORDER BY [col1],[col2],…[coln]; Tells DBMS according to what columns it should sort the result. If two rows will have the same value in col1 it will try to sort them according to col2 and so on. GROUP BY [col1],[col2],…[coln]; Tells DBMS to group (aggregate) results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average.
9.What are the MySQL database files stored in system ?
Ans: Data is stored in name.myd
Table structure is stored in name.frm
Index is stored in name.myi
10.How can we encrypt and decrypt a data presented in a table using MySQL?
Ans: You can use functions: AES_ENCRYPT() and AES_DECRYPT() like:
AES_ENCRYPT(str, key_str)
AES_DECRYPT(crypt_str, key_str)
11.What is the difference between htmlentities() and htmlspecialchars()?
Ans: htmlspecialchars() – Convert some special characters to HTML entities (Only the most widely used)
htmlentities() – Convert ALL special characters to HTML entities
Previous | Next |
:: Click the links below for similar type Questions and answers ::
0 comments:
Post a Comment