Saturday, 28 April 2012

PHP Interview question 15


56) How can we send mail using JavaScript?
Ans :      JavaScript does not have any networking capabilities as it is designed to work on client site. As a result we can not send mails using JavaScript. But we can call the client side mail protocol mailto
via JavaScript to prompt for an email to send. this requires the client to approve it.

57 How can we repair a MySQL table?
Ans :      The syntex for repairing a MySQL table is
REPAIR TABLENAME, [TABLENAME, ], [Quick],[Extended]
This command will repair the table specified if the quick is given the MySQL will do a repair of only the index tree if the extended is given it will create index row by row               

58) What are the advantages of stored procedures, triggers, indexes?
Ans :      A stored procedure is a set of SQL commands that can be compiled and stored in the server. Once this has been done, clients don't need to keep re-issuing the entire query but can refer to the stored procedure.
This provides better overall performance because the query has to be parsed only once, and less information needs to be sent between the server and the client. You can also raise the conceptual level by having libraries of functions in the server. However, stored procedures of course do increase the load on the database server system, as more of the work is done on the server side and less on the client (application) side.Triggers will also be implemented. A trigger is effectively a type of stored procedure, one that is invoked when a particular event occurs.
For example, you can install a stored procedure that is triggered each time a record is deleted from a transaction table and that stored procedure automatically deletes the corresponding customer from a
customer table when all his transactions are deleted.Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially. If you need to access most of the rows, it is faster to read sequentially, because this minimizes disk seeks.                

59) What is the maximum length of a table name, database name, and fieldname in MySQL?
Ans :      The following table describes the maximum length for each type of identifier.
Identifier             Maximum Length (bytes)
Database             64
Table     64
Column                64
Index    64
Alias       255
There are some restrictions on the characters that may appear in identifiers:

60) How many values can the SET function of MySQL take?
Ans :      MySQL set can take zero or more values but at the maximum it can take 64 values           

No comments:

Post a Comment