Top 40 Mysql Dba Interview Questions
Q1. What Is The Difference Between Database And Table?
There is a prime distinction between a database and a table. The variations are as follows:
Tables are a way to symbolize the division of data in a database whilst, database is a collection of tables and facts.
Tables are used to institution the information in relation with each different and create a dataset. This dataset may be used inside the database. The statistics which can be stored inside the desk in any form is a part of the database, but the opposite isn't true.
Q2. What Is Regexp?
REGEXP is a pattern in shape using ordinary expression. Regular expression is a effective manner of specifying a pattern for a complex search.
Q3. What Is The Difference Between Float And Double?
FLOAT stores floating factor numbers with accuracy up to eight locations and allocates four bytes, however DOUBLE shops floating point numbers with accuracy up to 18 places and allocates 8 bytes.
Q4. What Is The Use Of Mysql_close()?
Mysql_close() cannot be used to shut the continual connection. Though it could be used to close connection opened with the aid of mysql_connect().
Q5. What Does " I_am_a_dummy Flag" Do In Mysql?
The " i_am_a_dummy flag" allows MySQL engine to refuse any UPDATE or DELETE assertion to execute if the WHERE clause is not gift.
Q6. 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 web page each time whilst it loaded.
Mysql_pconnect:
In Mysql_pconnect, "p" stands for persistent connection so it opens the persistent connection.
The database connection can't be closed.
It's far greater beneficial if your web page has extra site visitors due to the fact there may be no want to open and close connection frequently and whenever while web page is loaded.
Q7. How Is Myisam Table Stored?
MyISAM desk is stored on disk in three formats.
'.Frm' report : storing the table definition
'.MYD' (MYData): statistics file
'.MYI' (MYIndex): index document
Q8. Which Command Is Used To View The Content Of The Table In Mysql?
The SELECT command is used to view the content material of the table in MySQL.
Q9. What Are The Different Tables Present In Mysql?
There are many tables that stay present by using default. But, MyISAM is the default database engine used in MySQL. There are 5 varieties of tables which are gift:
MyISAM
Heap
Merge
INNO DB
ISAM
Q10. How Do You Determine The Location Of Mysql Data Directory?
The default vicinity of MySQL facts directory in windows is C:mysqldata or C:Program FilesMySQLMySQL Server 5.Zero facts.
Q11. What Are The Differences Between Mysql_fetch_array(), Mysql_fetch_object(), Mysql_fetch_row()?
Mysql_fetch_object is used to retrieve the end result from the database as objects at the same time as mysql_fetch_array returns result as an array. This will allow get admission to to the data via the sphere names.
For example:
Using mysql_fetch_object field may be accessed as $end result->call.
Using mysql_fetch_array discipline can be accessed as $end result->[name].
Using mysql_fetch_row($end result) wherein $end result is the result resource back from a successful query completed the usage of the mysql_query() feature.
Example:
1.$end result = mysql_query("SELECT * from students");
2.Even as($row = mysql_fetch_row($end result))
three.
Four.Some announcement;
five.
Q12. What Is The Difference Between Mysql And Sql?
SQL is called widespread query language. It is used to have interaction with the database like MySQL. MySQL is a database that stores various kinds of facts and maintains it safe.
A PHP script is needed to keep and retrieve the values within the database.
Q13. What Is The Difference Between Heap Table And Temporary Table?
Heap tables:
Heap tables are observed in memory. They are used for high velocity garage on brief basis. They do not allow BLOB or TEXT fields.
Heap tables do no longer support AUTO_INCREMENT.
Indexes should be NOT NULL.
Temporary tables:
The temporary tables are used to keep the temporary data. Sometimes it's miles very beneficial in instances to preserve transient facts. Temporary desk is deleted after cutting-edge consumer session terminates.
Main differences:
The heap tables are shared among customers while brief tables aren't shared.
Heap tables are simply another storage engine, while for temporary tables you need a unique privilege (create temporary table).
Q14. What Are The Technical Specification Of Mysql?
MySQL has the subsequent technical specs -
Flexible shape
High performance
Manageable and smooth to use
Replication and high availability
Security and garage control
Q15. How To Display Nth Highest Salary From A Table In A Mysql Query?
Let us take a desk named employee.
To locate Nth maximum earnings is:
@select awesome(earnings) from worker order via income desc limit n-1,1
in case you need to find third largest revenue:
@select awesome(revenue) from worker order by way of profits desc restriction 2,1
Q16. What Is The Difference Between Char And Varchar?
A listing of differences among CHAR and VARCHAR:
CHAR and VARCHAR types are extraordinary in garage and retrieval.
CHAR column period is fixed to the duration that is declared at the same time as growing desk. The duration price degrees from 1 and 25@
When CHAR values are saved then they're proper padded using spaces to particular duration. Trailing areas are eliminated when CHAR values are retrieved.
Q17. How To Get The Current Date In Mysql?
To get modern-day date, use the subsequent syntax:
SELECT CURRENT_DATE();
Q18. What Is Mysql Data Directory?
MySQL information directory is a place in which MySQL shops its information. Each subdirectory below this statistics dictionary represents a MySQL database. By default the data managed my MySQL = server mysqld is saved in information directory.
Q19. What Is Blob And Text In Mysql?
BLOB is an acronym stands for binary large object. It is used to preserve a variable quantity of records.
There are four kinds of BLOB.
TINYBLOB
BLOB
MEDIUMBLOB
LONGBLOB
The variations among most of these are the maximum length of values they are able to keep. TEXT is case-insensitive BLOB. TEXT values are non-binary strings (person string). They have a man or woman set and values are stored and in comparison primarily based at the collation of the man or woman set.
There are four kinds of TEXT.
TINYTEXT
TEXT
MEDIUMTEXT
LONGTEXT
Q20. In Which Language Mysql Is Written?
MySQL is written in C and C++ and its SQL parser is written in yacc.
Q21. 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 faraway get right of entry to.
Q22. What Are The Advantages Of Mysql In Comparison To Oracle?
MySQL is a free, rapid, dependable, open supply relational database even as Oracle is costly, despite the fact that they've provided Oracle free edition to draw MySQL users.
MySQL uses most effective simply beneath 1 MB of RAM on your pc while Oracle 9i set up uses 128 MB.
MySQL is top notch for database enabled web sites at the same time as Oracle is made for corporations.
MySQL is portable.
Q23. What Is Mysql?
MySQL is a multithreaded, multi-user SQL database control gadget which has more than eleven million installations. This is the world's second maximum popular and widely used open supply database.
Q24. What Are The Advantages Of Myisam Over Innodb?
MyISAM follows a conservative technique to disk area management and shops each MyISAM desk in a separate document, which can be further compresses, if required. On the alternative hand, InnoDB stores the tables in tablespace. Its similarly optimization is tough.
Q25. How Many Columns Can You Create For An Index?
You can create maximum of sixteen indexed columns for a popular desk.
Q26. What Is The Usage Of Enums In Mysql?
ENUMs are used to restrict the viable values that cross within the table:
For instance: CREATE TABLE months (month ENUM 'January', 'February', 'March'); INSERT months VALUES ('April').
Q27. How Many Triggers Are Possible In Mysql?
There are best six Triggers allowed to apply in MySQL database.
Before Insert
After Insert
Before Update
After Update
Before Delete
After Delete
Q28. What Is Mysql Default Port Number?
MySQL default port wide variety is 3306.
Q29. How Do You Backup A Database In Mysql?
It is straightforward to backing up facts with phpMyAdmin. Select the database you want to backup by clicking the database name within the left hand navigation bar. Then click on the export button and make certain that all tables are highlighted that you want to backup. Then specify the option you want underneath export and save the output.
Q30. What Is The Usage Of Regular Expressions In Mysql?
In MySQL, everyday expressions are utilized in queries for searching a sample in a string.
* Matches zero greater instances of the string previous it.
+ suits 1 greater instances of the string previous it.
? Matches zero or 1 times of the string preceding it.
. Matches a unmarried man or woman.
[abc] suits separates strings
^ anchors the suit from the start.
"." Can be used to healthy any single character. "may be used to suit both of the 2 strings
REGEXP can be used to suit the input characters with the database.
Example:
The following announcement retrieves all rows in which column employee_name includes the text one thousand (instance earnings):
Select employee_name
From employee
Where employee_name REGEXP '1000'
Order with the aid of employee_name
Q31. What Is Sqlyog?
SQLyog application is the most popular GUI tool for admin. It is the most famous MySQL manager and admin tool. It combines the features of MySQL administrator, phpMyadmin and others MySQL the front ends and MySQL GUI equipment.
Q32. 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.
Q33. What Is Heap Table?
Tables which can be found in reminiscence is known as HEAP tables. When you create a heap desk in MySQL, you ought to want to specify the TYPE as HEAP. These tables are normally known as memory tables. They are used for high pace garage on temporary basis. They do not allow BLOB or TEXT fields.
Q34. What Is The Usage Of I-am-a-dummy Flag In Mysql?
In MySQL, the i-am-a-dummy flag makes the MySQL engine to deny the UPDATE and DELETE instructions except the WHERE clause is gift.
Q35. What Is The Difference Between Now() And Current_date()?
NOW() command is used to expose contemporary year, month, date with hours, mins and seconds even as CURRENT_DATE() shows the modern 12 months with month and date simplest.
Q36. What Is The Difference Between Truncate And Delete In Mysql?
The DELETE command is used to delete statistics from a desk. It only deletes the rows of statistics from the table whilst, truncate may be very dangerous command and ought to be used cautiously because it deletes every row permanently from a table.
Q37. What Are The Disadvantages Of Mysql?
MySQL isn't always so efficient for huge scale databases.
It does no longer guide COMMIT and STORED PROCEDURES functions version much less than five.@
Tractions are not dealt with very efficiently.
Q38. Why Do We Use Mysql Database Server?
The MySQL database server may be very fast, reliable and easy to apply. You can without difficulty use and alter the software program. MySQL software can be downloaded freed from value from the net.
Q39. How To Change A Password For An Existing User Via Mysqladmin?
Mysqladmin -u root -p password "newpassword".
Q40. What Is A Trigger In Mysql?
A trigger is a fixed of codes that executes in response to a few occasions.
