MySql is a multi-threading, multi-user open source SQL database management system. It is typically used for web application development, and often accessed using PHP.
- Difference between JDBC and Hibernate?
- Interview Tips and Tricks – Its All Abоut Marketing the Skills and Talents
- Digging into the ways to delete multiple records in codeigniter
- How Does A MongoDB Developer Certification Benefit Your Career
- What Is The Best Programming Language For The Mobile Application Development?
Mysql Interview Questions
- Question 1) What is MySql ?
- Question 2) In which language it is written ?
- Question 3) What is MySql default port number ?
- Question 4) How do you start MySQL on Linux?
- Question 5) Explain the difference between mysql and mysql interfaces in PHP?
- Question 6) What does tee command do in MySQL?
- Question 7) How do you change a password for an existing user via mysqladmin?
- Question 8) How to use mysqldump to create a copy of the database?
- Question 9) List some MySql advantages and disadvantages?
- Question 10) What is mysqlcheck do ?
- Question 11) What is mysqldump ?
- Question 12) What mysql -u john -p command does ?
- Question 13) Explain Timestamp ?
- Question 14) Command to list all Databases in MySql ?
- Question 15) What is “i_am_a_dump” flag in MySql ?
- Question 16) What is difference between UNIX timestamp and mysql timestamp ?
- Question 17) What are the advantages of stored procedures, triggers, indexes?
- Question 18) Explain the difference between MyISAM Static and MyISAM Dynamic. ?
- Question 19) Explain advantages of InnoDB over MyISAM?
- Question 20) What is the maximum length of a table name, database name, and fieldname in MySQL?
- Question 21) How many values can the SET function of MySQL take?
- Question 22) What are HEAP tables in MySQL?
- Question 23) Write command to import an mysql file?
- Question 24) How to store binary data in mysql?
- Question 25) What is difference between Group by and order by clause?
- Question 26) How to find Second highest salary from a table ?
- Question 27) Explain Triggers and Stored Procedures?
- Question 28) What is difference between Inner vs Self vs Cross?
- Question 29) What is difference between Innodb and MyISAM?
- Question 30) What are the types of database engines available in MySQL?
- Question 31) What are the indexes in MySQL?
- Question 32) What is difference between clustered index and non clustered index?
Below are the list of Best Mysql Interview Questions and Answers
MySql is a multi-threading, multi-user open source SQL database management system .
It is typically used for web application development, and often accessed using PHP.
MySql is writen in C and C++ and SQL parser writen in yacc.
MySql default port number is 3306
/etc/init.d/mysql start command is used for start MySQL on Linux
mysqli is the object-oriented version of mysql library functions.
Tee followed by a filename turns on MySQL logging to a specified file. It can be stopped by command note.
mysqladmin -u root -p password “newpassword”
mysqldump -h mysqlhost -u username -p mydatabasename > dbdump.sql
Advantages of using Mysql in compared to Orcale
- MySQL is a free, fast, reliable, open source relational database while Oracle is expensive, although they have provided Oracle free edition to attract MySQL users.
- MySQL uses only just under 1 MB of RAM on your laptop while Oracle 9i installation uses 128 MB.
- MySQL is great for database enabled websites while Oracle is made for enterprises.
- MySQL is portable.
Disadvantages of MySql.
- MySQL is not so efficient for large scale databases.
- It does not support COMMIT and STORED PROCEDURES functions version less than 5.0.
- Transactions are not handled very efficiently.
mysqlcheck is a client program that check the integrity of database tables.
mysqldump is a client program that creates logical backups of database.
mysql -u john -p command will prompt for the password for user john before allowing access to the database management system.
If your database server requires a username and password to gain access the -u and -p command-line options.
Timestamp is a data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.
“i_am_a_dump” enables MySQL engine to refuse any UPDATE or DELETE statement to execute if the WHERE clause is not present.
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.
A stored procedure is a set of SQL commands that can be compiled and stored in the server. Once this has been done, clients don’t need to keep re-issuing the entire query but can refer to the stored procedure.
This provides better overall performance because the query has to be parsed only once, and less information needs to be sent between the server and the client. You can also raise the conceptual level by having libraries of functions in the server. However, stored procedures of course do increase the load on the database server system, as more of the work is done on the server side and less on the client (application) side. Triggers will also be implemented. A trigger is effectively a type of stored procedure, one that is invoked when a particular event occurs.
For example, you can install a stored procedure that is triggered each time a record is deleted from a transaction table and that stored procedure automatically deletes the corresponding customer from a customer table when all his transactions are deleted. Indexes are used to find rows with specific column values quickly.
Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question,
MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially. If you need to access most of the rows, it is faster to read sequentially, because this minimizes disk seeks.
In MyISAM static all the fields have fixed width. The Dynamic MyISAM table would include fields such as TEXT, BLOB, etc. to accommodate the data types with various lengths. MyISAM Static would be easier to restore in case of corruption, since even though you might lose some data, you know exactly where to look for the beginning of the next record.
Advantages of InnoDB over MyISAM
- Row-level locking
- foreign key constraints
- crash recovery
The following table describes the maximum length for each type of identifier.
- Database 64 bytes
- Table 64 bytes
- Column 64 bytes
- Index 64 bytes
- Alias 255 bytes
There are some restrictions on the characters that may appear in identifiers.
MySQL set can take zero or more values but at the maximum it can take 64 values.
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.
Run below command on the terminal to import a MySQL database from the file
mysql -u username -p database_name < file.sql
If you have to store the short piece of data like password hashes then it is advised to store it in VARCHAR.
If you need to store arbitrary chunks of binary data then BLOB is the desired product to store the data.
Related Interview Questions
DB2 Interview Questions
DBMS Interview Questions
Stored procedures Interview questions
Mysql Interview Questions
Mssql Interview Questions
MongoDB Interview Questions
Neo4j interview questions
NoSQL interview questions
Oracle Interview Questions
OrientDB interview questions
PL/SQL Interview Questions
Postgresql Interview Questions
Redis interview questions
SQLite interview questions
RavenDB Interview Questions
Couchdb Interview Questions
Weblogic Interview Questions
MariaDB Interview Questions
Cassandra Interview Questions
PouchDB Interview Questions
Oracle DBA Interview Questions
Subscribe Our NewsLetter
Never Miss an Articles from us.
- Most Common Interview Questions
- Python Flask Interview Questions
- NoSQL interview questions
- JQuery Interview Questions
- C programming interview questions
- AngularJS Interview Questions
- Node JS Interview Questions with Express
- Core Java interview questions
- HTML Interview Questions
- Laravel interview questions
- Wordpress Interview Questions
- PHP Interview Questions