Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Beginning MySQL
|
BOOK: Beginning MySQL
This is the forum to discuss the Wrox book Beginning MySQL by Robert Sheldon, Geoff Moes; ISBN: 9780764579509
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 5th, 2009, 12:47 PM
Authorized User
 
Join Date: Dec 2007
Posts: 65
Thanks: 9
Thanked 2 Times in 2 Posts
Send a message via AIM to sandeepgreaternoida Send a message via MSN to sandeepgreaternoida Send a message via Yahoo to sandeepgreaternoida
Lightbulb [IF NOT EXISTS] expert opinion needed

<database definition>::=
CREATE DATABASE [IF NOT EXISTS] <database name>
[[DEFAULT] CHARACTER SET <character set name>]
[[DEFAULT] COLLATE <collation name>]

=>what is the disadvantage of not using [IF NOT EXISTS] clause.
=> if there is no disadvantage then why we use this clause ?


waiting for reply
__________________
sandeep gupta
 
Old April 5th, 2009, 03:29 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Ummm...simple.

If the database already exists, then the CREATE DATABASE will give you an error, "Database already exists."

If you *KNOW* the DB does not exist, you don't need the IF NOT EXISTS.

If you don't mind getting an error (e.g., if you are trapping the error in your Java/PHP/ASP/ASP.NET code), then you don't need it, either.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Installation of Opinion Poll ssertial BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 October 26th, 2008 06:35 PM
Opinion - How would you of done this differently? dparsons Intro Programming 0 May 15th, 2007 02:00 PM
Your Opinion Needed Aaron Edwards ASP.NET 2.0 Basics 0 December 3rd, 2006 01:33 PM
An opinion on my join please mat41 Classic ASP Professional 2 March 29th, 2004 02:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.