Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

MySQL Interview Questions and Answers

Test your skills through the online practice test: MySQL Quiz Online Practice Test

Ques 61. How To Return Query Output in XML Format?

By default, "mysql" returns query output in text table format. If you want to receive query output in XML format, you need to use the "-X" command option. Here is a good tutorial exercise:

>cd mysqlbin
>mysql -u root -X test

mysql> SELECT * FROM links;
<?xml version="1.0"?>
<resultset statement="SELECT * FROM links">
<row>
<field name="id">1</field>
<field name="name">www.GlobalGuideLine.com</field>
</row>
<row>
<field name="id">10</field>
<field name="name">www.GlobalGuideLine.com</field>
</row>
</resultset>

Is it helpful? Add Comment View Comments
 

Ques 62. What Is SQL in MySQL?

SQL, SEQUEL (Structured English Query Language), is a language for RDBMS (Relational Database Management Systems). SQL was developed by IBM Corporation.

Is it helpful? Add Comment View Comments
 

Ques 63. 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.

Is it helpful? Add Comment View Comments
 

Ques 64. What Are String Data Types?

MySQL supports the following string data types:

► CHAR(n) same as CHARACTER(n) - Fixed width and " " padded characters strings. Default character set is ASCII.
► NCHAR(n) same as NATIONAL CHARACTER(n) - Fixed width and " " padded character strings with UTF8 character set.
► VARCHAR(n) same as CHARACTER VARYING(n) - Variable width character strings. Default character set is ASCII.
► NVARCHAR(n) same as NATIONAL CHARACTER VARYING(n) - Variable width character strings with UTF8 character set.
► BINARY(n) - Fixed width and 0x00 padded byte strings.
► VARBINARY(n) same as BINARY VARYING(n) - Variable width byte string.
► TINYBLOB - BLOB (Binary Large Object) upto 255 bytes.
► BLOB - BLOB (Binary Large Object) upto 64K bytes.
► MEDIUMBLOB - BLOB (Binary Large Object) upto 16M bytes.
► LONGBLOB - BLOB (Binary Large Object) upto 4G bytes.
► TINYTEXT - CLOB (Binary Large Object) upto 255 characters.
► TEXT - CLOB (Binary Large Object) upto 64K characters.
► MEDIUMTEXT - CLOB (Binary Large Object) upto 16M characters.
► LONGTEXT - CLOB (Binary Large Object) upto 4G characters.
► ENUM - An enumeration to hold one entry of some pre-defined strings.
► SET - A set to hold zero or more entries of some pre-defined strings.

Is it helpful? Add Comment View Comments
 

Ques 65. What Are the Differences between CHAR and NCHAR?

Both CHAR and NCHAR are fixed length string data types. But they have the following differences:

► CHAR's full name is CHARACTER.
► NCHAR's 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.

The following column definitions are the same:

CREATE TABLE faq (Title NCHAR(80));
CREATE TABLE faq (Title NATIONAL CHAR(80));
CREATE TABLE faq (Title NATIONAL CHARACTER(80));
CREATE TABLE faq (Title CHAR(80) CHARACTER SET utf8);
CREATE TABLE faq (Title CHARACTER(80) CHARACTER SET utf8);

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook