The Free Online Tutorials, and Always will be.

MySQL Interview Questions

What is MySQL ?

MySQL is a very popular widely used open source Relational Database Management System (RDBMS) based on SQL. it is widely used in online web apps for storing and fetching the data.

In which language MySQL is writen ?

MySQL is written in c, c++.

Difference b/w MySQL and SQL ?

MySQL is an oracle product whereas SQL is a Microsoft product.
SQL is a query language whereas MySQL is a database server.
SQL is used to interact with the database server like MySQL whereas MySQL is a database server to store data in it.

Why we use MySQL ?

MySQL is a open source. it is free for small developers to use whereas for enterprises have a samll fee.
It is now a product of oracle and have a wide community for help and support.
MySQL database server is much fast than compare with others and it is easy to use.

Difference b/w char and varchar in MySQL ?

char is used for store fixed length data in it whereas varchar is used for store variable length data. char range is 0 - 255.
char always occupy the defined memory space whether it's value is less than define value
In varchar memory space vary on the data store in it if the value is less the define size it will free up the remaining memory space. varchar range is 0 - 4000.
for example : char
firstName char(10);
if the firstName value is tony. then memory occupy space for 10 chars.
for example : varchar
firstName varchar(10);
if the firstName value is tony. then memory occupy space for only 4 chars.

Difference b/w TRUNCATE, DELETE and DROP command in MySQL

DELETE command is used to delete data from a table based on where condition. in case of using a DELETE command we can undo this operation.
TRUNCATE command permanently delete all rows from a table the operation can't undo. it simply means empty a table and re-create blank table structure without any data in it.
DROP command is used to delete a table with its structure from the database permanently and the operation can't be undo.

How to Display the 3rd highest salary in MySQL ?

select distinct(emp_salary) from employee order by emp_salary desc limit 2,1.

What is MySQL default port Number ?

MySQL default port is : 3306

How many columns we can use for creating an index in MySQL ?

maximum limit is 16.