Solved

Combine Multiple Alter Statements

Posted on 2011-02-10
1
310 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
1 Comment
 
LVL 40

Accepted Solution

by:
Sharath earned 500 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
updating the date data 12 30
when to use sequences in mysql 4 29
Create a MySQL table as easily as possible 6 37
MySQL Query Using Up Memory 6 27
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

773 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