Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

MySQL Interview Questions and Answers

Ques 46. How Many SQL DML Commands Are Supported by "mysql"?

Ans. There are 4 SQL Data Manipulation Language (DML) commands that are supported by "mysql". They are listed below with short descriptions:

* "INSERT INTO tableName ..." - Inserts new data rows into the specified table.
* "DELETE FROM tableName ..." - Deletes existing data rows from the specified table.
* "UPDATE tableName SET ..." - Updates existing data rows in the specified table.
* "SELECT expressionList FROM ..." - Selects rows from tables and returns rows of values resulted from the specified expression list.

Here is a tutorial exercise of how to use DML commands to insert and select data rows:

>cd mysqlbin
>mysql -u root test

mysql> CREATE TABLE links (id INTEGER, name VARCHAR(80));
Query OK, 0 rows affected (0.10 sec)

mysql> INSERT INTO links VALUES (1, 'www.withoutbook.com');
Query OK, 1 row affected (0.02 sec)

mysql> SELECT * FROM links;
+------+-------------------------+

| id | name |

+------+-------------------------+

| 1 | www.GlobalGuideLine.com |

+------+-------------------------+

1 row in set (0.04 sec)

Is it helpful? Add Comment View Comments
Ques 47. What Are the Non-Standard SQL Commands Supported by "mysql"?
Ans. There are many non-standard SQL commands that are supported by "mysql". Here is short list of some commonly used commands:

► "SHOW infoName" - Shows basic information of based on the specified information name.
► "SHOW infoName" - Shows basic information of based on the specified information name.
► "SET ..." - Sets new values to server or connection session variables.
► "GRANT ..." - Grants access privileges to users.
► "REVOKE ..." - Revokes access privileges from users.
► "CHECK TABLE tableName" - Checks the specified table for errors.
► "ANALYZE TABLE tableName" - Analyzes the specified table.
► "REPAIR TABLE tableName" - Repairs the specified table.
► "BACKUP TABLE tableName" - Backs up the specified table.
► "RESTORE TABLE tableName" - Restores the specified table.
► "USE databaseName" - Uses the specified database as the current database.
► "HELP topicName" - Returns help information on the specified topic.
Is it helpful? Add Comment View Comments
Ques 48. How To Get Help Information from the Server?
Ans. While you are at the "mysql>" prompt, you can get help information from the server by using the "HELP" command. The tutorial exercise below shows several examples:

>cd mysqlbin
>mysql -u root

mysql> HELP;
...
List of all MySQL commands:
Note that all text commands must be end with ';'
? (?) Synonym for `help'.
clear (c) Clear command.
connect (r) Reconnect to the server.
...

mysql> HELP SHOW;
Name: 'SHOW'
Description:
SHOW has many forms that provide information about databases, tables, columns, or status information about the server. This section describes those following:

SHOW CREATE DATABASE db_name
SHOW CREATE FUNCTION funcname
SHOW CREATE PROCEDURE procname
SHOW CREATE TABLE tbl_name
SHOW DATABASES [LIKE 'pattern']
SHOW ENGINE engine_name {LOGS | STATUS }
...

mysql> HELP CREATE TABLE;
Name: 'CREATE TABLE'
Description:
Syntax:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [table_option ...]
...
Is it helpful? Add Comment View Comments
Ques 49. How To Run "mysql" Commands from a Batch File?
Ans. If you have group of "mysql" commands that need to be executed repeatedly, you can put them into a file, and run them from the file in "mysql" batch mode. Here is a batch file, templinks.sql, contains following commands:

USE wbtest;
INSERT INTO links VALUES (10, 'www.withoutbook.com');
SELECT * FROM links;

To run this batch file, you need to follow this tutorial:

>cd mysqlbin
>mysql -u root < templinks.sql id name
1 www.withoutbook.com
10 www.withoutbook.com
Is it helpful? Add Comment View Comments
Ques 50. How To Return Query Output in HTML Format?
Ans. By default, \"mysql\" returns query output in text table format. If you want to receive query output in HTML format, you need to use the \"-H\" command option. Here is a good tutorial exercise:

>cd mysqlbin
>mysql -u root -H test

mysql> SELECT * FROM links;
<TABLE BORDER=1><TR><TH>id</TH><TH>name</TH></TR>
<TR><TD>1</TD><TD>www.withoutbook.com</TD></TR>
<TR><TD>10</TD><TD>www.withoutbook.com</TD></TR></TABLE>
2 rows in set (0.00 sec)
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2020 WithoutBook