Solved

Combine Multiple Alter Statements

Posted on 2011-02-10
1
309 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now