?
Solved

Combine Multiple Alter Statements

Posted on 2011-02-10
1
Medium Priority
?
314 Views
Last Modified: 2012-05-11
How can I combine these multiple statements into 1 alter statement:
ALTER TABLE address DROP INDEX 'zip';
ALTER TABLE address DROP INDEX 'phone';
ALTER TABLE address ADD 'fax' int(10) NOT NULL DEFAULT '0';
ALTER TABLE address ADD 'pobox' int(10) NOT NULL DEFAULT '0';
ALTER TABLE address ADD INDEX 'AddressIndex' ('UserID');

Thanks!
0
Comment
Question by:interclubs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 41

Accepted Solution

by:
Sharath earned 2000 total points
ID: 34869036
You can club all into one statement.
alter table address drop index zip,
                    drop index phone,
                    add fax int(10) not null default 0,
                    add pobox int(10) not null default 0,
                    add index AddressIndex(UserID);

Open in new window

0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question