Friday 27 March 2015

most Important interview questions with answers for php freshers

What is the difference between sql and Mysql?
SQL or Structured Query Language is a programming language designed for managing data held in a Relational Database Management System. Mysql is a open source, relational database management System.
Why do we use GROUP BY and ORDER BY function in mysql?
Group By is used for retrieving information about a group of data. It is generally used with some aggregate function like SUM, AVG etc. ORDER BY is used to sort the records using column name. It can sort column in both ascending and descending order.
What is JOIN in mysql? What are the different types of join?
When we have to fetch records from more than one table we can use JOIN keyword. The process is known as joining the tables. There are various types of join like INNER JOIN, LEFT JOIN, RIGHT JOIN, and OUTER JOIN.
Why is the basic difference between LEFT JOIN, RIGHT JOIN and INNER JOIN?
INNER Join compares two tables and only returns results where a match exists. Records from the 1st table are duplicated when they match multiple results in the 2nd. INNER joins tend to make result sets smaller, but because records can be duplicated this isn’t guaranteed.
LEFT join means keep all records from the 1st table no matter what and insert NULL values when the 2nd table doesn’t match.
RIGHT Join means the opposite: keep all records from the 2nd table no matter what and insert NULL values when the 1st table doesn’t match.
If we use SUM function in mysql, does it return sum of that row or for that column?
Sum function works on the column basis and will return the sum of that particular row only.
What do we use to remove duplicate records while fetching a data in mysql ?
We use DISTINCT keyword.
What is the use of count function in mysql?
count() is used for fetching the total number records in a table.
How do we use % when performing a search query?
Suppose take an example where you need to fetch all customer data where name stats with sa
SELECT * FROM Customers WHERE name LIKE ‘sa%';
Another case is where you need to fetch all customer data where kumar is found irrespective of the position (middle name or last name).
SELECT * FROM Customers WHERE name LIKE ‘%kumar%';
How do we delete a row in a table?
Take an example
DELETE FROM customer WHERE cid=150;
In this case it will delete the record of the customer with customer id 150
How do we drop a table?
DROP table customers;
It will drop the table customers
Why do we use multipart/form-data in html form?
This is the encoding used to send image or files via form, The data will be split into multiple parts and, one for each files plus one for the text of the form body that may be sent with them.
What is AJAX?
AJAX (Asynchronous JavaScript and XML) is a technique which allows updating parts of a web page, without reloading the whole page. Data is exchanged asynchronously in small amounts of data with the server.
What is jQuery?
jQuery is a fast, small, and feature-rich JavaScript library. It is an easy-to-use API which makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler across a multitude of browsers.

No comments:

Post a Comment