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

论坛 期权论坛 脚本     
已经匿名di用户   2022-4-16 00:32   1901   0

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语句

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP