MySQL Interview Questions
MySQL Interview Questions
In hierarchical database Parent can have many children, but in the case of
children, have only one parent
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
5. What is Network Database
1. Network Database:- (ex:- Integrated data store)
The concept of network database model allows all the child to have multiple
parents and also it helps to solve the more complex model
It uses many to many relationship
8. Property of RDBMS
Some of the Properties of RDBMS are :-
1. Values are Atomic in RDBMS (Multiple operations can be grouped into a single
entity)
2. Each column can have common name
3. Integrity constraints helps to maintain the data consistency for multiple tables
4. Each row is Different
5. Columns are Different
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
Parameter
SQL MySQL
SQL is a structured query MySQL is an RDBMS to
Definition
language, It is useful to store, retrieve, modify and
manage relational Database administrate a database using
SQL
It is readily available through
You need to learn the SQL
Complexity download and installation
language to use it effectively
MySQL is database software,
SQL is a Query Language
It uses SQL Language to query
Type
the database
To Query and Operate Allows data handling, storing,
Purpose database system modifying, deleting in a
tabular format.
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
Data Type
Data Model
19. What is the difference Between Where Clause and Having Clause
Where Clause Having Clause
Where clause is used to filter the Having clause used to filter the records
records based on specified from group based on specified condition
condition
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
Where clause cannot have Having clause can operate on aggregate
aggregate function function ex:-[sum, count, min, max, avg]
Where clause is implemented on
Having clause is implemented on
rows
columns
Where clause are executed before
group by and after from clause Having clause are executed after group
by clause
23. What are Keys and Explain the type of DBMS Keys in detail
Keys:- DBMS Keys are one of the most important concept in RDBMS, It is used to
uniquely identify the records in a table. And It is used to make the relationship between
two table.
Why we need DBMS Keys :-
For Identifying any row of data in a table uniquely
We can ensure integrity of data is maintained.
Establish relationship between tables and identifying relationship between table.
Types of DBMS Keys are:-
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
1. Super Key
2. Candidate Key
3. Primary Key
4. Foreign Key
5. Composite and Compound Key
6. Alternate Key
7. Surrogate Key
Super Key:-
An Attribute or a set of Attribute that can be used to identify row of data in a table
Ex:- S.ID, Reg ID, Emial ID, S.ID+Reg ID, S.ID+Email ID, Reg ID + Email ID,
S.ID+Reg ID+ Email ID
Candidate Key:-
Candidate key is nothing but minimal subset of super key.
In a table we can have multiple candidate key, An candidate key can have null value
Ex:- S.ID, Reg ID, Email ID
Primary Key:-
The Most Appropriate Candidate key is Primary Key, Will Pick any one of the Attribute
from the candidate key as a Primary Key.
Alternate Key:-
Alternate key is nothing but in a candidate key that is not considered as Primary key
Foreign Key:-
It is an Attribute in a table which is used to define its relationship with another
table
Foreign Key is nothing but you are taking reference from other table, where in the
reference table, reference attribute should be unique.
The table containing a foreign key is a child table, The table that has reference to
is a Parent table
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
Composite Key:-
Any key with more than one attribute is called composite key
Ex:- (SID, Reg ID), (Reg ID, Email ID), (Email ID, SID),(SID, Reg ID, Email Id)
Compound Key:-
If a composite key has at-least one attribute which is a foreign key then it is called as
compound key
Ex:- In the above example if we have composite key (Reg ID, Branch code) then it will
be known as compound key because Branch code Attribute is a Foreign key.
Surrogate Key:-
Sometimes a table has no attribute that can uniquely identify the row in the table
In this situation when there is no Natural Primary Key than will create an attribute that
act as an primary key that is known as Surrogate key
This key do not adds any meaning to the data but serves the sole purpose of identifying
rows uniquely in the table.
1. Clustered Index is used for easy 1. Non-Clustered Index is used for easy
retrieval of the data from the retrieval of data from the database and is
database and is faster slower
2. One Table can only have one
2. One table can have many non-
clustered index
clustered index
3. Clustered index alters the way,
The records are stored in database, 3. Non-clustered index does not alter the
As it sorts the rows by columns way records are stored, but it create
separate object with in a table.
Atomicity :- If one Part of any Transaction fails, Then Entire Transaction Fails and the
Data Base is left unchanged.
Consistency :- Data must meet all the validation rules [consistency should be maintained
before & after Transaction]
SQL INTERVIEW QUESTIONS & Answers by Jeevan Raj
Isolation :- Concurrency Control [Multiple Transaction occur independently without
Interference]
Durability:- If the Transaction has been committed it will occur what ever may come
between like crash or system failure
ACID Properties
Transactions system in the database has 4 basic properties which are called as
ACID properties. These properties play crucial understanding with the transactions
happening in the database. They are used to maintain the consistency in the
database during transactions.
Properties of transactions are:
29. What is the Main difference between ‘BETWEEN’ and ‘IN’ Condition operator