删表sql
㈠ 鍦⊿QL璇瑷涓锛屽疄鐜板垹闄ゅ熀链琛ㄧ殑璇鍙ヤ负锛 锛
DROP TABLE锛孲QL璇瑷涓鏁版嵁瀹氢箟锷熻兘锛屽畾涔夊熀链琛ㄧ殑锘烘湰镎崭綔链塁REATE TABLE銆丄LTER TABLE鍜娈ROP TABLE锛屽叾涓鍒犻櫎锘烘湰琛ㄧ殑璇鍙ユ槸鐢盌ROP TABLE𨱒ュ畬鎴愮殑銆
鍦⊿QL涓锛岀敤浜庡湪鏁版嵁搴扑腑鍒涘缓銆佷慨鏀瑰拰鍒犻櫎锘烘湰琛ㄧ粨鏋勭殑锻戒护鍒嗗埆鏄痠nsert銆乽pdate鍜宒elete锻戒护銆傛坊锷犮佷慨鏀瑰拰鍒犻櫎锻戒护灞炰簬缁撴瀯鍖栨煡璇㈣瑷镄勬暟鎹镎崭綔璇瑷锛岀敤鎴峰彲浠ラ氲繃杩欎簺锻戒护瀹炵幇鏁版嵁搴撶殑锘烘湰镎崭綔銆
镓╁𪾢璧勬枡
sql镓鎻愪緵镄勫熀链鏁版嵁绫诲瀷锛(濡俕00100009b^)
鏁版嵁搴撶殑寤虹珛涓庡垹闄
(1)寤虹珛鏁版嵁搴掳细鏁版嵁搴撴槸涓涓鍖呮嫭浜嗗氢釜锘烘湰琛ㄧ殑鏁版嵁闆锛屽叾璇鍙ユ牸寮忎负锛
CREATE DATABASE <鏁版嵁搴揿悕> 銆斿叾瀹冨弬鏁般
鍏朵腑锛<鏁版嵁搴揿悕>鍦ㄧ郴缁熶腑蹇呴’鏄鍞涓镄勶纴涓嶈兘閲嶅嶏纴涓岖劧灏嗗艰嚧鏁版嵁瀛桦彇澶辫銆
渚嬶细瑕佸缓绔嬮”鐩绠$悊鏁版嵁搴(xmmanage)锛屽叾璇鍙ュ簲涓猴细
CREATE DATABASE xmmanage
(2)鏁版嵁搴撶殑鍒犻櫎锛氩皢鏁版嵁搴揿强鍏跺叏閮ㄥ唴瀹逛粠绯荤粺涓鍒犻櫎銆
鍏惰鍙ユ牸寮忎负锛欴ROP DATABASE <鏁版嵁搴揿悕>
㈡ 鍒犻櫎琛ㄧ殑sql锻戒护鏄浠涔
1銆丼QL璇瑷涓锛屽垹闄や竴涓琛ㄧ殑锻戒护鏄疍ROP锛屽缓绔嬩竴涓琛ㄧ殑锻戒护鏄疌REATE锛屽硅〃杩涜屼慨鏀圭殑锻戒护鏄疉LTER锛屽彟澶栬缮链夎〃涓鏁版嵁镄勬彃鍏ワ纴鍒犻櫎锛屾煡璇㈠懡浠ゅ垎鍒涓篒NSERT锛孶PDATE鍜孲ELECT銆
2銆乨rop鏄鍒犻櫎鏁翠釜琛锛宒elete鏄鍒犻櫎琛ㄧ殑鍐呭广
3銆乨rop璇鍙ョ殑浣灭敤锛氩垹闄ゅ唴瀹瑰拰瀹氢箟锛岄喷鏀剧┖闂达纴绠鍗曟潵璇村氨鏄鎶婃暣涓琛ㄥ幓鎺夈备互钖庤佹柊澧炴暟鎹鏄涓嶅彲鑳界殑锛岄櫎闱炴柊澧炰竴涓琛ㄣ
4銆佸垹闄よ〃镞堕渶瑕佹敞镒忕殑浜嬮”锛氩傛灉鍒犻櫎搴旂敤琛ㄥ埆钖嶏纴鍒檇elete 钖庨溃涓瀹氲佹帴瀵瑰簲镄勫埆钖嶏纴铹跺悗鍐嶆帴琛ㄥ悕锛屼笉铹舵姤阌欍俤elete鍒犻櫎sql钖庨溃涓嶅彲鎺ラ氶厤绗*锛屽嵆delete * from 锛岃繖镙蜂细鎶ラ敊銆俤elete鍒犻櫎sql榛樿ょ殑杩斿洖鍊间负int鏁版嵁绫诲瀷锛屽綋鍒犻櫎涓𨱒℃暟鎹镞讹纴杩斿洖int鏁版嵁1锛屽綋鍒犻櫎num𨱒℃暟鎹镞讹纴鍒栾繑锲瀒nt绫诲瀷num銆