PHP / mysql interview questions and answers for experienced candidates

Why triggers are used in mysql?

Answer # The MySQL trigger is a database object that is associated with a table. It will be activated when a defined action is executed for the table. The trigger can be executed when you run one of the following MySQL statements on the table: INSERT, UPDATE and DELETE and it can be invoked before or after the event.

 

How we can retrieve the data in the result set of MySQL using PHP?

mysql_fetch_row
mysql_fetch_array
mysql_fetch_object
mysql_fetch_assoc

 

When should you use a stored procedure?

Answer # The benefits of using stored procedures in SQL Server rather than application code stored locally on client computers include: They allow modular programming. They allow faster execution. They can reduce network traffic.

Question # 84) What is the use of limit in mysql?

Answer # Limit Data Selections From a MySQL Database. MySQL provides a LIMIT clause that is used to specify the number of records to return. The LIMIT clause makes it easy to code multi page results or pagination with SQL, and is very useful on large tables. Returning a large number of records can impact on performance.