Tuesday 10 February 2015

MySQL Admin Interview Questions and Answers (Page 6)

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

26. How To Add a New Column to an Existing Table in MySQL?
ALTER TABLE tip ADD COLUMN author VARCHAR(40);
Query OK, 1 row affected (0.18 sec)
Records: 1 Duplicates: 0 Warnings: 0

27. How To Delete an Existing Column in a Table?
ALTER TABLE tip DROP COLUMN create_date;
Query OK, 1 row affected (0.48 sec)
Records: 1 Duplicates: 0 Warnings: 0

28. Flow To Rename an Existing Column in a Table?
ALTER TABLE tip CHANGE COLUMN subject
title VARCHAR(60);

29. How To Rename an Existing Table in MySQL?
ALTER TABLE tip RENAME TO faq;

30. How To Create a Table Index in MvSQL?
If you have a table with a lots of rows, and you know that one of the columns will be used often as a search criteria, you can add an index for that column to improve the search performance. To add an index, you can use the “CREATE INDEX” statement as shown in the following script:
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)
mysql> CREATE INDEX tip_subject ON tip(subject);
Query OK, 0 rows affected (0.19 sec)
Records: 0 Duplicates: 0 Warnings: 0
More Questions & Answers :-
Page1  Page2  Page3  Page4  Page5  Page6  Page7

No comments:

Post a Comment