drop sql語句
介紹 (Introduction)
This guide covers the SQL statement for dropping (deleting) one or more view objects.
本指南介紹了用于刪除(刪除)一個或多個視圖對象SQL語句。
A View is an object that presents data from one or more tables.
視圖是顯示來自一個或多個表的數據的對象。
Note: before deleting or changing data or objects, remember to have a fresh backup.
注意:刪除或更改數據或對象之前,請記住要進行全新備份。
We will cover:
我們將介紹:
- Using SQL to drop a table 使用SQL刪除表
- Using the workbench to drop a view 使用工作臺刪除視圖
We’ll be using MySQL for the demontration. Check the manual for this function in other Database Managers.
我們將使用MySQL進行清除。 在其他數據庫管理器中查看有關此功能的手冊。
We’ll drop the view called ?students_dropMe_v
, which was created just for this purpose.
我們將刪除名為students_dropMe_v
的視圖,該視圖就是為此目的而創建的。
基本語法 (Basic Syntax)
DROP VIEW [IF EXISTS]view_name [, view_name] ...
刪除視圖SQL (Drop View SQL)
The if exists portion will “trap” errors, should the view not exist.
如果該視圖不存在,則如果存在部分將“捕獲”錯誤。
drop view if exists students_dropMe_v;
The view after creation:
創建后的視圖:
使用工作臺 (Using the Workbench)
From the workbench:
在工作臺上:
- Right click on the view to drop 右鍵單擊視圖以拖放
- select drop view from the menu 從菜單中選擇下拉視圖
- Select either either a) run SQL to review the SQL statement to be executed or b) drop new 選擇a)運行SQL以檢查要執行SQL語句,或b)刪除新的
*As with all of these SQL things there is MUCH MORE to them than what’s in this introductory guide. I hope this at least gives you enough to get started.
*與所有這些SQL事物一樣,它們比本入門指南中的內容要多得多。 我希望這至少能給您足夠的入門。
Please see the manual for your database manager and have fun trying different options yourself.*
請參閱數據庫管理員手冊,并嘗試自己嘗試其他選項,以獲取樂趣。*
額外 (Extra)
Here’s the SQL I used to create the table that we just dropped:
這是我用來創建剛剛刪除的表SQL:
create view `students_dropMe_v` as
select FullName, programOfStudy
from student
where programOfStudy = 'Programming';
翻譯自: https://www.freecodecamp.org/news/the-sql-drop-view-statement/
drop sql語句