81+ MySQL Interview Questions

81+ MySQL Interview Questions

MySQL Interview Questions

1) What is MySQL? 

MySQL is a multithreaded, multi-client SQL database the board framework which has in excess of 11 million establishments. This is the world's second most famous and generally utilized open source database. It is intriguing how MySQL name was given to this question language. The term My is instituted by the name of the girl of fellow benefactor Michael Widenius' little girl, and SQL is the short type of Structured Query Language. Utilizing MySQL is free of expense for the designer, however ventures need to pay a permit charge to Oracle.

In the past MySQL was at first claimed by a revenue driven firm MySQL AB, at that point Sun Microsystems got it and after that Oracle purchased Sun Microsystems, so Oracle as of now possesses MySQL.

MySQL is an Oracle-bolstered Relational Database Management System (RDBMS) which depends on organized question language. MySQL bolsters wide scopes of working frameworks most acclaimed of those incorporate Windows, Linux and UNIX. In spite of the fact that it is conceivable to build up a wide scope of use with MySQL, it is utilized for web applications and internet distributing. It is a key piece of an open source endeavor known as Lamp.

What is Lamp?

Light is a stage utilized for web improvement. Light uses Linux, Apache, MySQL, and PHP as a working framework, web server, database and item situated scripting language individually. Also, subsequently contracted as LAMP.

2) In which language MySQL has been composed? 

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

3) What are the specialized particulars of MySQL? 

MySQL has the accompanying specialized particulars -

Adaptable structure


Reasonable and simple to utilize

Replication and high accessibility

Security and capacity the executives


Graphical Tools

MySQL Enterprise Monitor

MySQL Enterprise Security

JSON Support

Replication and High-Availability

Reasonability and Ease of Use

OLTP and Transactions

Geo-Spatial Support

4) What is the contrast among MySQL and SQL? 

SQL is known as the standard inquiry language. It is utilized to collaborate with the database like MySQL. MySQL is a database that stores different sorts of information and protects it.

A PHP content is required to store and recover the qualities inside the database.

SQL is a programming language, though MySQL is a product or an application

SQL is utilized for the making of database the board frameworks while MySQL is utilized to empower information taking care of, putting away, erasing and changing information

5) What is the distinction among database and table? 

There is a noteworthy distinction between a database and a table. The distinctions are as per the following:

Tables are an approach to speak to the division of information in a database while the database is an accumulation of tables and information.

Tables are utilized to assemble the information in connection with one another and make a dataset. This dataset will be utilized in the database. The information which are put away in the table in any structure is a piece of the database, however the turn around isn't valid.

A database is an accumulation of sorted out information and furthermore includes which are utilized to get to them, though table is a gathering of lines and sections which are utilized to store the information.

6) Why do we utilize the MySQL database server? 

Above all else MYSQL server is allowed to use for designers and a little charge for endeavors.

MySQL server is open source.

The people group of MySQL is huge and strong consequently any assistance viewing MySQL is settled as quickly as time permits.

MySQL has entirely stable variants accessible, as MySQL has been in the market since quite a while so all bugs emerging in the past forms have been constantly expelled and a truly steady form is given after each update.

The MySQL database server is exceptionally quick, dependable and simple to utilize. You can without much of a stretch use and adjust the product. MySQL programming can be downloaded free of expense from the web.

7) What are the diverse tables present in MySQL? 

There are numerous tables that stay present as a matter of course. Yet, MyISAM is the default database motor utilized in MySQL. There are five kinds of tables that are available:






8) What is the distinction among CHAR and VARCHAR? 

A rundown of contrasts among CHAR and VARCHAR:

Roast is variable-length while VARCHAR is of fixed length.

Roast and VARCHAR types are diverse away and recovery.

Scorch segment length is fixed to the length that is proclaimed while making a table. The length esteem ranges from 1 and 255.

At the point when CHAR esteems are put away when they are correct cushioned utilizing spaces to a particular length. Trailing spaces are evacuated when CHAR esteems are recovered.

Scorch utilizes static memory allotment though VARCHAR utilizes dynamic memory designation.

Roast is half quicker than VARCHAR.

9) What is the distinction among TRUNCATE and DELETE in MySQL? 

TRUNCATE is a DDL direction, DELETE is a DML order.

It is beyond the realm of imagination to expect to utilize Where direction with TRUNCATE yet you can utilize it with DELETE order.

TRUNCATE can't be utilized with ordered perspectives while DELETE can be utilized with recorded perspectives.

The DELETE direction is utilized to erase information from a table. It just erases the lines of information from the table while, truncate is exceptionally risky order and ought to be utilized cautiously in light of the fact that it erases each line for all time from a table.

10) what number Triggers are conceivable in MySQL? 

There are just six Triggers permitted to use in MySQL database.

Prior to Insert

After Insert

Prior to Update

After Update

Before Delete

After Delete

11) What is store table? 

Tables that are available in memory is known as HEAP tables. When you make a store table in MySQL, you should need to indicate the TYPE as HEAP. These tables are ordinarily known as memory tables. They are utilized for fast stockpiling on a brief premise. They don't permit BLOB or TEXT fields.

12) What is BLOB and TEXT in MySQL? 

Mass is an abbreviation represents an extensive paired item. It is utilized to hold a variable measure of information.

There are four sorts of BLOB.





The distinctions among all these are the most extreme length of qualities they can hold.

Content is a case-coldhearted BLOB. Content qualities are non-twofold strings (character string). They have a character set, and qualities are put away, and thought about dependent on the examination of the character set.

There are four sorts of TEXT.





13) What is a trigger in MySQL? 

A trigger is a lot of codes that executes in light of certain occasions.

14) What is the contrast between load table and transitory table? 

Pile tables:

Pile tables are found in memory. They are utilized for fast stockpiling on a transitory premise. They don't permit BLOB or TEXT fields.

Pile tables don't bolster AUTO_INCREMENT.

Files ought to be NOT NULL.

Brief tables:

The brief tables are utilized to keep the transient information. Now and again it is valuable in cases to hold transitory information. The Temporary table is erased after the present customer session ends.

Fundamental contrasts:

The store tables are shared among customers while transitory tables are not shared.

Load tables are simply one more stockpiling motor, while for brief tables you need an extraordinary benefit (make transitory table).

15) What is the contrast among FLOAT and DOUBLE? 

Buoy stores drifting point numbers with exactness up to 8 puts and apportions 4 bytes, then again DOUBLE stores coasting point numbers with precision up to 18 puts and distributes 8 bytes.

16) What are the benefits of MySQL in contrast with Oracle?

MySQL is a free, quick, solid, open source social database while Oracle is costly, despite the fact that they have given Oracle free release to draw in MySQL clients.

MySQL utilizes just barely under 1 MB of RAM on your PC while Oracle 9i establishment uses 128 MB.

MySQL is extraordinary for database empowered sites while Oracle is made for ventures.

MySQL is compact.

17) What are the inconveniences of MySQL? 

MySQL isn't so productive for extensive scale databases.

It doesn't bolster COMMIT and STORED PROCEDURES capacities form under 5.0.

Exchanges are not taken care of in all respects productively.

Usefulness of MySQL is profoundly needy of different addons.

Advancement isn't network driven.

18) What is the contrast among CHAR and VARCHAR? 

Singe and VARCHAR are vary away and recovery.

Singe section length is fixed while VARCHAR length is variable.

The most extreme no. of character CHAR information type can hold is 255 character while VARCHAR can hold up to 4000 character.

Roast is half quicker than VARCHAR.

Roast uses static memory portion while VARCHAR utilizes dynamic memory distribution.

19) What is the distinction among MySQL_connect and MySQL_pconnect? 


It opens another association with the database.

Each time you have to open and close database association, contingent upon the solicitation.

Opens page at whatever point it is stacked.


In Mysql_pconnect, "p" represents relentless association so it opens the constant association.

The database association can't be shut.

It is increasingly valuable if your site has more traffic on the grounds that there is no compelling reason to open and close association habitually and each time when page is stacked.

20) What does "i_am_a_dummy banner" do in MySQL? 

The "i_am_a_dummy banner" empowers MySQL motor to reject any UPDATE or DELETE explanation to execute if the WHERE proviso is absent. Thus it can spare the software engineer from erasing the whole table my error on the off chance that he doesn't utilize WHERE condition.

21) How to get the present date in MySQL? 

To get current date, utilize the accompanying language structure:


22) What are the security cautions while utilizing MySQL? 

Introduce antivirus and arrange the working framework's firewall.

Never utilize the MySQL Server as the UNIX root client.

Change root username and secret phrase Restrict or impair remote access.

23) How to change a secret word for a current client by means of Mysqladmin? 

Mysqladmin - u root - p secret phrase "newpassword".

24) What is the distinction between Unix timestamps and MySQL timestamps? 

All things considered both Unix timestamp and MySQL timestamp are put away as 32-bit whole numbers however MySQL timestamp is spoken to in meaningful configuration of YYYY-MM-DD HH:MM:SS position.

25) How to show Nth most noteworthy pay from a table in a MySQL inquiry? 

Give us a chance to take a table named the representative.

To discover Nth most astounding compensation is:

select distinct(salary)from worker request by compensation desc limit n-1,1

on the off chance that you need to discover third biggest compensation:

select distinct(salary)from representative request by compensation desc limit 2,1

26) What is MySQL default port number? 

MySQL default port number is 3306.

27) What is REGEXP? 

REGEXP is an example coordinate utilizing a standard articulation. A Regular articulation is an incredible method for indicating an example for an advanced pursuit.

Fundamentally it is an exceptional content string for portraying a pursuit design. To comprehend it better you can think about a circumstance of day by day life when you look for .txt records to list all content documents in the record director. The regex comparable for .txt will be .*\.txt.

28) what number sections would you be able to make for a list? 

You can make limit of 16 ordered sections for a standard table.

29) What is the distinction among NOW() and CURRENT_DATE()? 

Presently() direction is utilized to indicate current year, month, date with hours, minutes and seconds while CURRENT_DATE() demonstrates the present year with month and date as it were.

30) What is the question to show top 20 lines? 

SELECT * FROM table_name LIMIT 0,20;

31) Write a question to show current date and time? 

On the off chance that you need to show current date and time, use -


On the off chance that you need to show current date just, use:


32) What is spare point in MySQL? 

A characterized point in any exchange is known as savepoint.

SAVEPOINT is an announcement in MySQL which is utilized to set a named exchange spare point with a name of identifier.

33) What is SQLyog? 

SQLyog program is the most well known GUI apparatus for administrator. It is the most famous MySQL chief and administrator device. It joins the highlights of MySQL director, phpMyadmin and others MySQL front finishes and MySQL GUI apparatuses.

34) How would you reinforcement a database in MySQl? 

It is anything but difficult to back up information with phpMyAdmin. Select the database you need to reinforcement by tapping the database name in the left-hand route bar. At that point click the fare catch and ensure that all tables are featured that you need to back up. At that point indicate the choice you need under fare and spare the yield.

35) What are the diverse segment examination administrators in MySQL? 

The =, <>, <=, <, >=, >, <<, >>, < = >, AND, or LIKE administrator are the examination administrators in MySQL. These administrators are commonly utilized with SELECT explanation.

36) Write a question to tally the quantity of columns of a table in MySQL. 

SELECT COUNT user_id FROM clients;

37) Write a question to recover a hundred books beginning from twentieth. 

SELECT book_title FROM books LIMIT 20, 100;

38) Write an inquiry to choose all groups that won either 1, 3, 5 or 7 amusements. 

SELECT team_name FROM group WHERE team_won IN (1, 3, 5, 7);

39) What is the default port of MySQL Server? 

The default port of MySQL Server is 3306.

40) How is MyISAM table put away? 

MyISAM table is put away on plate in three organizations.

'.frm' document : putting away the table definition

'.MYD' (MYData): information document

'.MYI' (MYIndex): record document

41) What is the use of ENUMs in MySQL? 

ENUMs are string objects, by characterizing ENUMs we enable the end client to give right contribution as in the event that the client gives an information which isn't a piece of the ENUM characterized information then the inquiry won't execute and a mistake message will be shown which says "Wrong Query". For example guess we need to take the sexual orientation of the client as an info so we determine ENUM('male', 'female', 'other') and henceforth at whatever point the client endeavors to include any string some other than these three it results in a blunder.

ENUMs are utilized to constrain the conceivable qualities that go in the table:

For instance:

Make TABLE months (month ENUM 'January', 'February', 'Walk'); INSERT months VALUES ('April').

42) What are the upsides of MyISAM over InnoDB? 

MyISAM pursues a moderate way to deal with circle space the board and stores each MyISAM table in a different record, which can be further packs, whenever required. Then again, InnoDB stores the tables in tablespace. Its further enhancement is troublesome.

43) What are the contrasts between MySQL_fetch_array(), MySQL_fetch_object(), MySQL_fetch_row()? 

Mysql_fetch_object is utilized to recover the outcome from the database as items while mysql_fetch_array returns result as a cluster. This will enable access to the information by the field names.

For instance:

Utilizing mysql_fetch_object field can be gotten to as $result->name.

Utilizing mysql_fetch_array field can be gotten to as $result->[name].

Utilizing mysql_fetch_row($result) where $result is the outcome asset come back from a fruitful inquiry executed utilizing the mysql_query() work.


$result = mysql_query("SELECT * from understudies");

while($row = mysql_fetch_row($result))


Some announcement;


44) What is the contrast among mysql_connect and mysql_pconnect? 

Mysql_connect() is utilized to open another association with the database while mysql_pconnect() is utilized to open a persevering association with the database. It indicates that each time the page is stacked mysql_pconnect() does not open the database.

45) What is the utilization of mysql_close()? 

Mysql_close() can't be utilized to close the steady association. Despite the fact that it very well may be utilized to close association opened by mysql_connect().

46) What is MySQL information registry? 

MySQL information registry is where MySQL stores its information. Every subdirectory under this information word reference speaks to a MySQL database. As a matter of course the data dealt with my MySQL = server mysqld is put away in information catalog.

47) How would you decide the area of MySQL information index? 

The default area of MySQL information catalog in windows is C:\mysql\data or C:\Program Files\MySQL\MySQL Server 5.0 \data.

48) What is the utilization of ordinary articulations in MySQL? 

In MySQL, customary articulations are utilized in inquiries for looking through an example in a string.

* Matches 0 additional cases of the string going before it.

+ matches one additional cases of the string going before it.

? Matches 0 or 1 occasions of the string going before it.

. Matches a solitary character.

[abc] matches an or b or z

| isolates strings

^ stays the match from the begin.

"." Can be utilized to coordinate any single character. "|" can be utilized to coordinate both of the two strings

REGEXP can be utilized to coordinate the information characters with the database.


The accompanying articulation recovers all lines where segment employee_name contains the content 1000 (precedent pay):

Select employee_name

From worker

Where employee_name REGEXP '1000'

Request by employee_name

49) What is the use of "I-am-a-sham" banner in MySQL? 

In MySQL, the "I-am-a-sham" banner makes the MySQL motor to deny the UPDATE and DELETE directions except if the WHERE proviso is available.

50) Which order is utilized to see the substance of the table in MySQL?

The SELECT order is utilized to see the substance of the table in MySQL.

51) Explain Access Control Lists. 

An ACL is a rundown of authorizations which are related with an item. MySQL keeps the Access Control Lists stored in memory and at whatever point the client endeavors to validate or execute a direction, MySQL checks the authorization required for the article and in the event that the consents are accessible, at that point execution finishes effectively.

52) What is InnoDB? 

InnoDB is a capacity database for SQL. The ACID-exchanges are likewise given furthermore InnoDB additionally incorporates support for the remote key. At first claimed by InnobaseOY now has a place with Oracle Corporation after it gained the last since 2005.

53. What is ISAM? 

It is a framework for document the board created by IBM which enables records to get to consecutively or even haphazardly.

54. How might we run bunch mode in MySQL? 

To perform bunch mode in MySQL we utilize the accompanying order:


mysql mysql.out;

55. What are combined tables? 

United tables will be tables which focuses to the tables situated on different databases on some other server.

56. What is the contrast between essential key and competitor key? 

To distinguish each column of a table, an essential key is utilized. For a table, there exists just a single essential key.

An applicant key is a section or a lot of segments which can be utilized to exceptionally recognize any record in the database without referencing some other information.

57. What are the drivers in MySQL? 

Following are the drivers accessible in MySQL:

PHP Driver

JDBC Driver

ODBC Driver



PERL Driver

RUBY Driver

CAP11PHP Driver


58. What Is DDL, DML, And DCL? 

Significantly SQL directions can be partitioned into three classifications for example DDL, DML and DCL. Information Definition Language (DDL) manages all the database mappings, and it characterizes how the information ought to dwell in the database. Directions like CreateTABLE and ALTER TABLE are a piece of DDL.

Information Manipulative Language (DML) manages activities and controls on the information the directions in DML are Insert, Select and so on.

Information Control Languages (DCL) are identified with the Grant and consents. To put it plainly, the approval to get to any piece of database is characterized by these.