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 91. How Many Ways to Get the Current Time?

Ans. There are 8 ways to get the current time:

SELECT NOW() FROM DUAL;
2006-07-01 10:02:41

SELECT CURRENT_TIME() FROM DUAL;
10:02:58

SELECT SYSDATE() FROM DUAL;
2006-07-01 10:03:21

mysql> SELECT CURRENT_TIMESTAMP() FROM DUAL;
2006-07-01 10:04:03

SELECT LOCALTIME() FROM DUAL;
2006-07-01 10:07:37

mysql> SELECT LOCALTIMESTAMP() FROM DUAL;
2006-07-01 10:08:08

mysql> SELECT UTC_TIME() FROM DUAL;
14:09:22

mysql> SELECT UTC_TIMESTAMP() FROM DUAL;
2006-07-01 14:09:49

Is it helpful? Add Comment View Comments
Ques 92. What Are DDL Statements in MySQL?
Ans. DDL (Data Definition Language) statements are statements to create and manage data objects in the database. The are 3 primary DDL statements:

► CREATE - Creating a new database object.
► ALTER - Altering the definition of an existing data object.
► DROP - Dropping an existing data object.
Is it helpful? Add Comment View Comments
Ques 93. How To Create a New Table in MySQL?
Ans. If you want to create a new table, you can use the "CREATE TABLE" statement. The following tutorial script shows you how to create a table called "tip":

mysql> CREATE TABLE tip (id INTEGER PRIMARY KEY,
subject VARCHAR(80) NOT NULL,
description VARCHAR(256) NOT NULL,
create_date DATE NULL);

Query OK, 0 rows affected (0.08 sec)

This scripts creates a testing table called "tip" with 4 columns in the current database.
Is it helpful? Add Comment View Comments
Ques 94. What Happens If You No CREATE Privilege in a Database?
Ans. In order to create tables in a database, your user account must have the CREATE privilege for that database. Otherwise you will get an error as shown in the following tutorial exercise:

>cd mysqlbin
>mysql -u guest -ppub

mysql> use ggl;
Database changed

mysql> CREATE TABLE test (id integer);
ERROR 1142 (42000): CREATE command denied to user
'guest'@'localhost' for table 'test'

If you get this error, you need to see the DBA to obtain the CREATE privilege.
Is it helpful? Add Comment View Comments
Ques 95. How To Get a List of All Tables in a Database?
Ans. If you want to see the table you have just created, you can use the "SHOW TABLES" command to get a list of all tables in database. The tutorial script gives you a good example:

mysql> SHOW TABLES;
+---------------+

| Tables_in_ggl |

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

| links |

| tip |

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

3 rows in set (0.00 sec)
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2020 WithoutBook