請問有SQL指令可以找出是否己存在該資料庫嗎? |
答題得分者是:tech_state
|
saam
初階會員 發表:61 回覆:75 積分:27 註冊:2003-03-03 發送簡訊給我 |
|
tech_state
版主 發表:44 回覆:638 積分:641 註冊:2003-02-10 發送簡訊給我 |
|
saam
初階會員 發表:61 回覆:75 積分:27 註冊:2003-03-03 發送簡訊給我 |
|
timhuang
尊榮會員 發表:78 回覆:1815 積分:1608 註冊:2002-07-15 發送簡訊給我 |
在 my sql 的 help 有寫... 就是 tech_state前輩寫的沒錯, 只是 if exists 是選擇性參數, 所以正確要檢查已存在的話, 就直接下: DROP DATABASE IF EXISTS test_db 就可以了. ---------------------
6.5.2 DROP DATABASE Syntax DROP DATABASE [IF EXISTS] db_name DROP DATABASE drops all tables in the database and deletes the database. If you do a DROP DATABASE on a symbolic linked database, both the link and the original database is deleted. Be VERY careful with this command! DROP DATABASE returns the number of files that were removed from the database directory. Normally, this is three times the number of tables, because normally each table corresponds to a `.MYD' file, a `.MYI' file, and a `.frm' file. The DROP DATABASE command removes from the given database directory all files with the following extensions: All subdirectories that consists of 2 digits (RAID directories) are also removed. In MySQL Version 3.22 or later, you can use the keywords IF EXISTS to prevent an error from occurring if the database doesn't exist. 發表人 - timhuang 於 2003/04/23 21:08:25
|
saam
初階會員 發表:61 回覆:75 積分:27 註冊:2003-03-03 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |