MySQL is a RDBMS and an Important part of Dynamic applications. MySQL is most popular Database System so is also favourite of Interviewers in any interview for the post of Web Developer, QA , Software Developer, DBA etc. Here are some very basic concepts and important questions that are asked most frequently.
What are the storage engines used by MySQL?
Which one is the default storage Engine in MySQL?
The default engine is InnoDB.
What is a Database Engine?
Database Engine is the basic building blocks of storage systems , used by Database Management Systems to run CRUD (INSERT,SELECT,UPDATE,DELETE)instructions.
What is difference between InnoDB and MyISAM?
InnoDB is featured with ACID propety of transactions, but MyISAM does not support transaction. MyISAM supports FULLTEXT search index where as InnoDB does not.
What are HEAP tables in MySQL?
HEAP tables are the existing tables in memory.They also known as memory tables and use Indexes instead of BLOB and TEXT.
What are Stored Procedures in MySQL?
Stored Procedure is Batch of SQL statements and saved in database. It also accepts parameters and can be triggered explicitly. It improves the traffic control and gives a modular structure to implement maintainability.
CREATE PROCEDURE show_employee AS SELECT FirstName, LastName FROM employee; EXEC show_employee;
What is Trigger in MySQL?
Auto executable sets of SQL statements stored in database are known as Triggers. They are fired when some event CRUD event occurs.When we do some CRUD operations on table the trigger linked with that table fires. Trigger is behaves like a stored procedure but it invoked automatically. It adds a layer of security in database.
What are differences between Trigger and Stored Procedure?
We can execute procedure explicitly whenever we would like , but trigger can only be invoked on an event fire.We can call a Procedure inside another Procedure but we can not invoke a trigger directly inside another trigger. We can use trigger for transaction purpose but we can not use procedure for transactions.
What are the CONSTRAINT in MySQL?
MySQL CONSTRAINT used to define the rules for data restrictions. MySQL provides various types of constraints as:
NOT NULL– does not allow NULL value
UNIQUE – does not allow duplicate entry in column
PRIMARY KEY – uniquely identify a rows in a table
FOREIGN KEY – Primary Key of another table is being as a reference in another table
CHECK – Check for the valid data to be saved in the database
DEFAULT – set the default value for the column, in case of no value passed to SQL statement.
We can declare MySQL CONSTRAINT at the time of table creation or we can alter table to apply CONSTRAINT.
What do you mean by index in a table?
MySQL Indexing is the indexing of data as keys to make the accessibility fast and easy. Rather than searching all over the data indexing allows to get directly to the indexed values. It Eliminates the unnecessary iteration because the indexes are stored in the form of B.Tree.