MySQL Interview Questions and Answers

MySQL Interview Questions and Answers

MySQL is a relatively recent entrant into the well-established area of relational database management systems (RDBMs), a concept invented by IBM researcher Edgar Frank Codd in 1970. Despite the arrival of newer types of data repositories over the past 35 years, relational databases remain the workhorses of the information world. We can herewith list of latest and updated MySQL Interview Questions and their answers for fresher’s as well as experienced users.  These JavaScript interview question covers latest version of MySQL. 

Best MySQL Interview Questions and Answers

MySQL can run on very modest hardware and puts very little strain on system resources; many small users serve up information to their organizations by running MySQL on modest desktop systems. The speed with which it can retrieve information has made it a longstanding favorite of web administrators. Here you can find top best MySQL Interview Questions and Answers for beginners and professionals,

What’s 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.

How do you get the number of rows affected by query?

SELECT COUNT (user_id) FROM users would only return the number of user_id’ s.

What is DDL, DML and DCL?

If you look at the large variety of SQL commands, they can be divided into three large subgroups. Data Definition Language deals with database schemas and descriptions of how the data should reside in the database, therefore language statements like CREATE TABLE or ALTER TABLE belong to DDL.DML deals with data manipulation, and therefore includes most common SQL statements such

SELECT, INSERT, etc. Data Control Language includes commands such as GRANT, and mostly concerns with rights, permissions and other controls of the database system.

On executing the DELETE statement, I keep getting the error about foreign key constraint failing. What do I do?

What it means is that so of the data that you’re trying to delete is still alive in another table. Like if you have a table for universities and a table for students, which contains the ID of the university they go to, running a delete on a university table will fail if the students table still contains people enrolled at that university. Proper way to do it would be to delete the offending data first, and then delete the university in question.

Quick way would involve running SET foreign_key_checks=0 before the DELETE command, and setting the parameter back to 1 after the DELETE is done. If your foreign key was formulated with ON DELETE CASCADE, the data in dependent tables will be removed automatically. 

How do I find out all databases starting with ‘tech’ to which I have access to?

SHOW DATABASES LIKE ‘tech%’;

How do you concatenate strings in MySQL?

CONCAT (string1, string2, string3)

How do you get a portion of a string?

SELECT SUBSTR(title, 1, 10) from techpreparation_questions;

What’s the difference between CHAR_LENGTH and LENGTH?

The first is, naturally, the character count. The second is byte count. For the Latin characters the numbers are the same, but they’re not the same for Unicode and other encodings.

How do you convert a string to UTF-8?

SELECT (techpreparation_question USING utf8);

What do % and _ mean inside LIKE statement?

% corresponds to 0 or more characters, _ is exactly one character.

What does + mean in REGEXP?

At least one character. Appendix G. Regular Expressions from MySQL manual is worth perusing before the interview.

What’s the default port for MySQL Server?

3306

What does tee command do in MySQL?

tee followed by a filename turns on MySQL logging to a specified file. It can be stopped by command note.

Can you save your connection settings to a conf file?

Yes, and name it ~/.my.conf. You might want to change the permissions on the file to 600, so that it’s not readable by others.

How do you change a password for an existing user via mysqladmin?

mysqladmin -u root -p password “newpassword”

Use mysqldump to create a copy of the database?

mysqldump -h mysqlhost -u username -p mydatabasename > dbdump.sql


Have you ever used MySQL Administrator and MySQL Query Browser?

Describe the tasks you accomplished with these tools.

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.

What does myisamchk do?

It compressed the MyISAM tables, which reduces their disk usage.

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.

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.

How do you control the max size of a HEAP table?

MySQL config variable max_heap_table_size.

What are CSV tables?

Those are the special tables, data for which is saved into comma-separated values files. They cannot be indexed.

Explain federated tables?

Introduced in MySQL 5.0, federated tables allow access to the tables located on other databases on other servers.

MySQL is a database management system.

A database is a structured collection of data. It may be anything from a simple shopping list to a picture gallery or the vast amounts of information in a corporate network. To add, access, and process data stored in a computer database, you need a database management system such as MySQL. Since computers are very good at handling large amounts of data, database management plays a central role in computing, as stand-alone utilities, or as parts of other applications.

MySQL is a relational database management system.

A relational database stores data in separate tables rather than putting all the data in one big storeroom. This adds speed and flexibility. The tables are linked by defined relations making it possible to combine data from several tables on request. The SQL part of MySQL stands for “Structured Query Language” – the most common standardized language used to access databases.

MySQL is Open Source Software.

Open source means that it is possible for anyone to use and modify. Anybody can download MySQL from the Internet and use it without paying anything. Anybody so inclined can study the source code and change it to fit their needs. MySQL uses the GPL (GNU General Public License).

Why use MySQL?

MySQL is very fast, reliable, and easy to use. If that is what you are looking for, you should give it a try. MySQL also has a very practical set of features developed in very close cooperation with our users. You can find a performance comparison of MySQL to some other database managers on our benchmark page. See section 12.7 Using Your Own Benchmarks. MySQL was originally developed to handle very large databases much faster than existing solutions and has been successfully used in highly demanding production environments for several years.

Thus, the compilation of these MySQL questions includes some of the major points that can be asked during an interview. The MySQL interviewers generally check the base knowledge of a candidate, which can be gained by practicing these MySQL questions prior interview.

MySQL actually has a dual-license approach: if you want to build your own product around it, you pay MySQL AB a license fee. If you just want to use MySQL to serve your own data, you don’t have to pay the license fee. MySQL also offers technical support, as do numerous other companies and consultants, some of them probably near you.

So if you have finally found your dream job in MySQL but are wondering how to crack the MySQL Interview and what could be the probable MySQL Interview Questions. Every interview is different and the scope of a job is different too. Hope above assist you to get a dream Job. Keep Learn.

Online Training Tutorials

  • XML Interview QuestionsXML Interview Questions and AnswersBelow is the list of latest and updated XML interview questions and their answers for fresher’s as well as experienced users. These interview question covers basic and latest version of […]
  • VBScript Interview Questions and AnswersVBScript Interview Questions and AnswersVBScript is a powerful but easy-to learn scripting language that you can use to perform a number of useful activities, including enhancing your web pages and automating repetitive or […]
  • Siebel Interview Questions and AnswersSiebel Interview Questions and AnswersSiebel is a CRM (Customer Relationship Management) application. It is mainly deployed by companies which have huge customer base and expect regular interaction with them. There are other […]
  • Ruby Interview QuestionsRuby Interview Questions and AnswersProgramming Ruby is known to Rubyists. It is a tutorial and reference for the Ruby programming language. Before we start talking about the Ruby language, it’d be useful if we helped you […]
  • PHP Interview QuestionsPHP Interview Questions and AnswersBelow is the list of latest and updated PHP interview questions and their answers for fresher’s as well as experienced users.  The combination of PHP and MySQL is the most convenient […]
  • OOP Interview Questions and AnswersOOP Interview Questions and AnswersThere are still people, for instance, that call Artificial Intelligence to any program that is written in Prolog or Lisp. In the same way, there are those who maintain that any program […]
  • OOAD Interview QuestionsOOAD Interview Questions and AnswersOOAD -Object-Oriented Design: The emphasis in programming methods is primarily on the proper and effective use of particular language mechanisms. By contrast, design methods emphasize the […]
  • JavaScript Interview Questions and AnswersJavaScript Interview Questions and AnswersJavascript is an interpreted language with a C like syntax. While many people brush the language off as nothing more than a browser scripting language, it actually supports many advanced […]