MySQL Interview Question Set 4

31. How can we get the number of rows affected by query?
Number of rows can be obtained by SELECT COUNT (user_id) FROM users;

32. Is Mysql query is case sensitive?
No SELECT VERSION(), CURRENT_DATE; SeLect version(), current_date; seleCt vErSiOn(), current_DATE; All these examples are same. It is not case sensitive.

33. What is the difference between the LIKE and REGEXP operators? 
LIKE and REGEXP operators are used to express with ^ and %. SELECT * FROM employee WHERE emp_name REGEXP "^b"; SELECT * FROM employee WHERE emp_name LIKE "%b";

34. What is the difference between BLOB AND TEXT?
A BLOB is a binary large object that can hold a variable amount of data. There are four types of BLOB –

  • BLOB

They all differ only in the maximum length of the values they can hold.
A TEXT is a case-insensitive BLOB. The four TEXT types

  • TEXT

They all correspond to the four BLOB types and have the same maximum lengths and storage requirements.
The only difference between BLOB and TEXT types is that sorting and comparison is performed in case-sensitive for BLOB values and case-insensitive for TEXT values.

35. What is the difference between mysql_fetch_array and mysql_fetch_object?
Following are the differences between mysql_fetch_array and mysql_fetch_object:
mysql_fetch_array() -Returns a result row as an associated array or a regular array from database.
mysql_fetch_object – Returns a result row as object from database.

36. How can we run batch mode in mysql?
Following commands are used to run in batch mode: mysql ; mysql mysql.out

37. Where MyISAM table will be stored and also give their formats of storage?
Each MyISAM table is stored on disk in three formats:

  • The ‘.frm’ file stores the table definition
  • The data file has a ‘.MYD’ (MYData) extension
  • The index file has a ‘.MYI’ (MYIndex) extension

38. What are the different tables present in MySQL?
Total 5 types of tables are present:

  • MyISAM
  • Heap
  • Merge
  • ISAM

MyISAM is the default storage engine as of MySQL .

39. What is ISAM?
ISAM is abbreviated as Indexed Sequential Access Method.It was developed by IBM to store and retrieve data on secondary storage systems like tapes.40. What is InnoDB?lnnoDB is a transaction safe storage engine developed by Innobase Oy which is a Oracle Corporation now.

Leave a Reply

Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.