The AND & OR are treated as joining operators in MySQL.
### 4. What IFNULL() statement is used for in MySQL? ###
**Ans**: The Query in MySQL can be written precisely using **IFNULL()** statement. The IFNULL() statement test its first argument and returns if it’s not NULL, or returns its second argument, otherwise.
mysql> SELECT name, IFNULL(id,'Unknown') AS 'id' FROM taxpayer;
+---------+---------+
| name | id |
+---------+---------+
| bernina | 198-48 |
| bertha | Unknown |
| ben | Unknown |
| bill | 475-83 |
+---------+---------+
### 5. You want to see only certain rows from a result set from the beginning or end of a result set. How will you do it? ###
**Ans**: We need to use **LIMIT** clause along with ORDER BY to achieve the above described scenario.
**Ans**: Well both has its advantages and disadvantages. As a matter of time I prefer MySQL.
#### Reason for Selection MySQL Over oracle ####
- Mysql is FOSS.
- MySQL is portable.
- MYSQL supports both GUI as well as Command Prompt.
- MySQL Administration is supported over Query Browser.
### 7. How will you get current date in MySQL? ###
**Ans**: Getting current date in MySQL is as simple as executing the below SELECT Statement.
mysql> SELECT CURRENT_DATE();
+----------------+
| CURRENT_DATE() |
+----------------+
| 2014-06-17 |
+----------------+
### 8. How will you export tables as an XML file in MySQL? ###
**Ans**: We use ‘-e‘ (export) option to export MySQL table or the whole database into an XML file. With large tables we may need to implement it manually but for small tables, applications like phpMyAdmin can do the job.
A native command of MySQL can do it.
mysql -u USER_NAME –xml -e 'SELECT * FROM table_name' > table_name.xml
Where USER_NAME is username of Database, table_name is the table we are exporting to XML and table_name.xml is the xml file where data is stored.
### 9. What is MySQL_pconnect? And how it differs from MySQL_connect? ###
**Ans**: MySQL_pconnect() opens a connection that is persistent to the MySQL Database which simply means that the database is not opened every-time the page loads and hence we can not use MySQL_close() to close a persistent connection.
A brief difference between MySQL_pconnect and MySQL_connect are.
Unlike MySQL_pconnect, MySQL_connect – Opens the Database every-time the page is loaded which can be closed any-time using statement MySQL_close().
### 10. You need to show all the indexes defined in a table say ‘user’ of Database say ‘mysql’. How will you achieve this? ###
**Ans**: The following command will show all the indexes of a table ‘user’.
**Ans**: CSV stands for Comma-Separated Values aka Character-Separated Values. CSV table stores data in plain text and tabular format. It typically contains one record per line.
Each record is separated by specific delimiters (Comma, Semi-colon, …) where each record has same sequence of field. CSV tables are most widely used to store phone contacts to Import and Export and can be used to store any sort of plain text data.
That’s all for now. I’ll be here again with another Interesting article, you people will love to read. Till then stay tuned and connected to Tecmint and Don’t forget to provide us with your valuable feedback in the comment section below.