Thursday, August 6, 2015

MySQL Interview Questions and Answers 2015

MySQL Interview Questions and Answers 2015,Top 25 MySQL Interview Questions,MySQL Interview Questions & Answers,MySQL Interview Questions and Answers For Freshers and Experienced. MySQL Frequently Asked Interview Questions,Freshers Latest MySQL Technical Interview Questions & Answers,F2F Interview,MySQL, Interview Questions & Answers,What would be some common MySQL interview questions,MySQL interview questions and answers for 2 years,MySQL Developer Interview Questions,10 Common face to face MySQL interview questions and answers,MySQL Interview Questions and Answers,Top 10 MySQL Interview Questions and Answers 2015,MySQL (CMS)Interview Question Answer,Technical MySQL Interview Questions and Answers for getting Job,Where can I find good MySQL interview questions,MySQL job interview questions and answers for freshers,MySQL interview questions and answers for experienced,10 Tough MySQL Interview Questions With Smart Answers,MySQL interview questions and answers for experienced,How to Answer MySQL Interview Questions,Where can I find good MySQL interview questions ,Download MySQL Interview Questions.

1) What is MySQL?

MySQL is a multithreaded, multi-user SQL database management system which has more than 11 million installations. This is the world's second most popular and widely used open source database.

2) In which language MySQL is written?

MySQL is written in C and C++ and its SQL parser is written in yacc.

3) What are the technical specification of MySQL?

MySQL has the following technical specifications -

Flexible structure
High performance
Manageable and easy to use
Replication and high availability
Security and storage management
4) How many Triggers are possible in MySQL?

There are only six Triggers allowed to use in MySQL database.

Before Insert
After Insert
Before Update
After Update
Before Delete
After Delete
5) What is heap table?

Tables that are present in memory is known as HEAP tables. When you create a heap table in MySQL, you should need to specify the TYPE as HEAP. These tables are commonly known as memory tables. They are used for high speed storage on temporary basis. They do not allow BLOB or TEXT fields.

6) What is BLOB and TEXT in MySQL?

BLOB is an acronym stands for binary large object. It is used to hold a variable amount of data.

There are four types of BLOB.

TINYBLOB
BLOB
MEDIUMBLOB
LONGBLOB
The differences among all these are the maximum length of values they can hold.

TEXT is case-insensitive BLOB. TEXT values are non-binary strings (character string). They have a character set and values are stored and compared based on the collation of the character set.

There are four types of TEXT.

TINYTEXT
TEXT
MEDIUMTEXT
LONGTEXT
7) What is a trigger in MySQL?

A trigger is a set of codes that executes in response to some events.

8) What is the difference between heap table and temporary table?

Heap tables:

Heap tables are found in memory. They are used for high speed storage on temporary basis. They do not allow BLOB or TEXT fields.

Heap tables do not support AUTO_INCREMENT.

Indexes should be NOT NULL.

Temporary tables:

The temporary tables are used to keep the temporary data. Sometimes it is very useful in cases to keep temporary data. Temporary table is deleted after current client session terminates.

Main differences:

The heap tables are shared among clients while temporary tables are not shared.

Heap tables are just another storage engine, while for temporary tables you need a special privilege (create temporary table).

9) What is the difference between FLOAT and DOUBLE?

FLOAT stores floating point numbers with accuracy up to 8 places and allocates 4 bytes, on the other hand DOUBLE stores floating point numbers with accuracy up to 18 places and allocates 8 bytes.

10) What are the advantages of MySQL in comparison to Oracle?

MySQL is a free, fast, reliable, open source relational database while Oracle is expensive, although they have provided Oracle free edition to attract MySQL users.
MySQL uses only just under 1 MB of RAM on your laptop while Oracle 9i installation uses 128 MB.
MySQL is great for database enabled websites while Oracle is made for enterprises.
MySQL is portable.

11) What are the disadvantages of MySQL?

MySQL is not so efficient for large scale databases.
It does not support COMMIT and STORED PROCEDURES functions version less than 5.0.
Transactions are not handled very efficiently.

12) What is the difference between CHAR and VARCHAR?

1) CHAR and VARCHAR are differ in storage and retrieval.

2) CHAR column length is fixed while VARCHAR length is variable.

3) The maximum no. of character CHAR data type can hold is 255 character while VARCHAR can hold up to 4000 character.

4) CHAR is 50% faster than VARCHAR.

5) CHAR uses static memory allocation while VARCHAR uses dynamic memory allocation.

13) What is the difference between MySQL_connect and MySQL_pconnect?

Mysql_connect:

It opens a new connection to the database.
Every time you need to open and close database connection, depending on the request.
Opens page every time when it loaded.
Mysql_pconnect:

In Mysql_pconnect, "p" stands for persistent connection so it opens the persistent connection.
the database connection can not be closed.
it is more useful if your site has more traffic because there is no need to open and close connection frequently and every time when page is loaded.

14) What does " i_am_a_dummy flag" do in MySQL?

The " i_am_a_dummy flag" enables MySQL engine to refuse any UPDATE or DELETE statement to execute if the WHERE clause is not present.

15) How to get the current date in MySQL?

To get current date, use the following syntax:

SELECT CURRENT_DATE();
16) What are the security alerts while using MySQL?

Install antivirus and configure the operating system's firewall.

Never use the MySQL Server as the UNIX root user.

Change root username and password

Restrict or disable remote access.

17) How to change a password for an existing user via Mysqladmin?

Mysqladmin -u root -p password "newpassword".

18) What is the difference between Unix timestamps and MySQL timestamps?

Actually both Unix timestamp and MySQL timestamp are stored as 32-bit integers but MySQL timestamp is represented in readable format of YYYY-MM-DD HH:MM:SS format.

19) How to display Nth highest salary from a table in a MySQL query?

Let us take a table named employee.

To find Nth highest salary is:

select distinct(salary) from employee order by salary desc limit n-1,1
if you want to find 3rd largest salary:

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

20) What is MySQL default port number?

MySQL default port number is 3306.

21) What is REGEXP?

REGEXP is a pattern match using regular expression. Regular expression is a powerful way of specifying a pattern for a complex search.

22) How many columns can you create for an index?

You can create maximum of 16 indexed columns for a standard table.

23) What is the difference between NOW() and CURRENT_DATE()?

NOW() command is used to show current year, month, date with hours, minutes and seconds while CURRENT_DATE() shows the current year with month and date only.

24) What is the query to display top 20 rows?

SELECT * FROM table_name LIMIT 0,20;

25) Write a query to display current date and time?

If you want to display current date and time, use -

SELECT NOW();
If you want to display current date only, use -
SELECT CURRENT_DATE();

0 comments:

Post a Comment