Tuesday 10 February 2015

mysql dba interview questions and answers (Page 3)

Below are some important MySQL interview questions which are asked in most MNC company interviews for beginners or professionals.

11. What Is Commit?
Commit is a way to terminate a transaction with all database changes to be saved permanently to the database server.

12. What Is Rollback?
Rollback is a way to terminate a transaction with all database changes not saving to the database server.

13. How Many Groups of Data Types?
MySQL support 3 groups of data types as listed below:
 String Data Types - CHAR, NCHAR, VARCHAR, NVARCHAR, BINARY, VARBINARY, TINYBLOB, TINYTEXT,
BLOB, TEXT, MEDIUMBLOB, MEDIUMTEXT, LONGBLOB, LONGTEXT, ENUM, SET
Numeric Data Types - BIT, TINYINT, BOOLEAN, SMALLINT, MEDIUMINT, INTEGER, BIGINT, FLOAT,
DOUBLE, REAL, DECIMAL.
Date and Time Data Types - DATE, DATETIME, TIMESTAMP, TIME, YEAR.

14. What Are the Differences between CHAR and NCHAR?
Both CHAR and NCHAR are fixed length string data types. But they have the following differences:
CHARs full name is CHARACTER.
NCHARs full name is NATIONAL CHARACTER.
By default, CHAR uses ASCII character set. So 1 character is always stored as 1 byte.
By default, NCHAR uses Unicode character set. NCHAR data are stored in UTF8 format. So 1 character
could be stored as 1 byte or upto 4 bytes.
Both CHAR and NCHAR columns are defined with fixed lengths in units of characters.

15. How To Escape Special Characters in SQL statements?
There are a number of special characters that needs to be escaped (protected), if you want to include them in a character string. Here are some basic character escaping rules:
The escape character () needs to be escaped as (\).
The single quote (‘) needs to be escaped as (‘) or (“) in single-quote quoted strings.
The double quote () needs to be escaped as (“) or (““) in double-quote quoted strings.
The wild card character for a single character () needs to be escaped as (_).
The wild card character for multiple characters (%) needs to be escaped as (%).
The tab character needs to be escaped as (t).
The new line character needs to be escaped as (n).
The carriage return character needs to be escaped as (r).
More Questions & Answers :-

No comments:

Post a Comment