Frequently asked basic and advanced MySql Queries Interview Questions and Answers.
1. What is MySQL?
MySQL is an open source RDBMS which is built, supported and distributed by MySQL (now acquired by Oracle).
2. What is the Differentiate between FLOAT and DOUBLE ?
FLOAT stores floating point numbers with accuracy up to eight places and has four bytes while DOUBLE stores floating point numbers with accuracy upto 18 places and has eight bytes.
3. What do you mean by % and _ in the LIKE statement ?
% corresponds to 0 or more characters, _ is exactly one character in the LIKE statement.
5. How will you obtain list of all the databases?
To list all currently running databases run the command on mysql shell as: show databases;
6. How do you concatenate strings in MySQL?
Select CONCAT (firstname,’ ‘, middle_name,’ ‘, lastname) AS Name From table;
7. What is the difference between mysql_fetch_array and mysql_fetch_object?
mysql_fetch_array() -Returns a result row as an associated array or a regular array from database.
mysql_fetch_object – Returns a result row as object from database.
8. What are HEAP tables in MySQL? –
HEAP tables are in-memory. They are usually used for high-speed temporary storage.
No TEXT or BLOB fields are allowed within HEAP tables. You can only use the comparison operators = and <=>.
HEAP tables do not support AUTO_INCREMENT. Indexes must be NOT NULL.
9. How many columns can be used for creating Index?
Maximum of 16 indexed columns can be created for any standard table.
10. Explain advantages of InnoDB over MyISAM?
– Row-level locking, transactions, foreign key constraints and crash recovery.