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 96. How To Get a List of Columns in an Existing Table?

Ans. mysql> SHOW COLUMNS FROM test;

Is it helpful? Add Comment View Comments
Ques 97. How To See the CREATE TABLE Statement of an Existing Table?
Ans. SHOW CREATE TABLE test;
Is it helpful? Add Comment View Comments
Ques 98. How To Create a New Table by Selecting Rows from Another Table in MySQL?
Ans. Let's say you have a table with many data rows, now you want to create a backup copy of this table of all rows or a subset of them, you can use the "CREATE TABLE ... SELECT" statement. The tutorial script below gives you a good example:

mysql> INSERT INTO tip VALUES (1, 'Learn MySQL',
'Visit www.GlobalGuideLine.com','2006-07-01');
Query OK, 1 row affected (0.62 sec)

mysql> CREATE TABLE tipBackup SELECT * FROM tip;
Query OK, 1 row affected (0.49 sec)
Records: 1 Duplicates: 0 Warnings: 0
Is it helpful? Add Comment View Comments
Ques 99. How To Add a New Column to an Existing Table in MySQL?
Ans. If you have an existing table with existing data rows, and want to add a new column to that table, you can use the "ALTER TABLE ... ADD COLUMN" statement. The tutorial script below shows you a good example:

mysql> ALTER TABLE test ADD COLUMN author VARCHAR(40);
Query OK, 1 row affected (0.18 sec)
Records: 1 Duplicates: 0 Warnings: 0
Is it helpful? Add Comment View Comments
Ques 100. How To Delete an Existing Column in a Table?
Ans. If you have an existing column in a table and you do not need that column any more, you can delete it with "ALTER TABLE ... DROP COLUMN" statement. Here is a tutorial script to delete an existing column:

mysql> ALTER TABLE test DROP COLUMN create_date;
Query OK, 1 row affected (0.48 sec)
Records: 1 Duplicates: 0 Warnings: 0
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2020 WithoutBook