My-Sql Interview Questions and Answers

What is MySQL ?

MySQL (pronounced 'my ess cue el') is an open source relational database management system (RDBMS) that uses Structured Query Language (SQL), the most popular language for adding, accessing, and processing data in a database. Because it is open source, anyone can download MySQL and tailor it to their needs in accordance with the general public license(http://www.gnu.org). its a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server.

how to list or view all databases from the mysql server?
mysql> show databases;
how to list or view all databases from the mysql server?
mysql> show databases;
How Switch (select or use) to a database?
mysql> use databasename;

How To see all the tables from a database of mysql server?
mysql> show tables;
What are some good ideas regarding user security in MySQL?
There is no user without a password. There is no user without a user name. There is no user whose Host column contains % (which here indicates that the user can log in from anywhere in the network or the Internet). There are as few users as possible (in the ideal case only root) who have unrestricted access.
Explain advantages of InnoDB over MyISAM?
Row-level locking, transactions, foreign key constraints and crash recovery.

Explain advantages of MyISAM over InnoDB?
Much more conservative approach to disk space management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB.
The Main Features of MySQL?

The following list describes some of the important characteristics of MySQL: 
Fully multi-threaded using kernel threads. That means it can easily use multiple CPUs if available. 
C, C++, Eiffel, Java, Perl, PHP, Python and Tcl APIs. Works on many different platforms. 
Many column types: signed/unsigned integers 1, 2, 3, 4, and 8 bytes long, FLOAT, DOUBLE, CHAR, 
VARCHAR, TEXT, BLOB, DATE, TIME, DATETIME, TIMESTAMP, YEAR, SET, and ENUM types.
Very fast joins using an optimized one-sweep multi-join. Full operator and function support.
Very fast B-tree disk tables with index compression. Up to 32 indexes per table are allowed.
Written in C and C++. Tested with a broad range of different compilers.
A very fast thread-based memory allocation system. 
No memory leaks. Tested with a commercial memory leakage detector (purify). 
Includes myisamchk, a very fast utility for table checking, optimization, and repair.

Latest Updates

Ratio and Proportion

A certain sum of money is divided between A and B in the ratio of 5/4 : 5/3 and A got Rs. 360/-. Find the total sum of money and B’s share?

In an office, the ratio of the salaries of an officer and a clerk is 15:7. If the salary of a clerk is Rs. 720/- less than the salary of the officer, find the salary of each?

In an election to a municipal council, the votes secured by two candidates are in the ratio 13:19. The elected candidates gets 312 votes more than the second candidate. How many votes are secured by the second candidate?

A certain sum of money is divided between Murthy and Prasad in the ratio 22/7 : 8/3. If Murthy gets Rs. 120/- more than Prasad, find the share of each?

In a cricket test series, the runs made by Raju and Tendulkar are in the ratio 5:9 and Tendulkar and Azar are in the ratio 6:7. What are the runs made by them if Azar makes 187 runs more than Raju?

If A:B = 2:3 and B:C = 9:5 find A:B:C?

If A:B = 3/5:5/7 and B:C = 3/4:2/5, find A:B:C?

If R:S = 0.01:0.11 and S:T = 2.2:1, Find R:S:T?

In a school, Under a Saving Scheme, Rekha saves 3/2 times the savings of Bindu, Geeta saves 4 times the savings of Rekha. Find the ratio of the savings of all the three in least terms?

Simplification

A man left 1/3 rd of his property to his wife and 3/5 th of the remainder to his daughter. He gave the rest to his son who received Rs. 6400/-. How much was his original property worth?

Ratio and Proportion

In a school 4/9 of the pupils are boys. There are 125 girls. How many boys are there?

If A:B = 3:4 and B:C = 5:6, find A:C?

IF X:Y = 3:4 AND Y:Z = 4:5, FIND X:Y:Z?

Area

A house site is in the shape of a square. Its area is 1225 sq metres. What is its perimeter?

The area of a square field is 7396 sq metres. Find its perimeter?

Numbers

Twice the first of three consecutive even integer is 6 more than the second integer. What is the third integers?

Ratio and Proportion

If 2x=3y and 4y=5z, then what is x:z=?

What quantity must be added to each term of the ratio a + b : a – b to make it equal to (a + b)2 : (a – b)2 ?