drop sql语句_用于从表中删除数据SQL Drop View语句

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:

在工作台上:

  1. Right click on the view to drop

    右键单击视图以拖放
  2. select drop view from the menu

    从菜单中选择下拉视图
  3. 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语句

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值