sql - 如果不存在则创建 View ?

标签 sql mysql view h2

有没有办法在 MySQL 或 H2 数据库中如果不存在则创建 View

最佳答案

来自 12.1.12. CREATE VIEW Syntax 部分MySQL 5.0 引用手册:

CREATE VIEW Syntax

CREATE
    [OR REPLACE]
    [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]
    [DEFINER = { user | CURRENT_USER }]
    [SQL SECURITY { DEFINER | INVOKER }]
    VIEW view_name [(column_list)]
    AS select_statement
    [WITH [CASCADED | LOCAL] CHECK OPTION]

The CREATE VIEW statement creates a new view, or replaces an existing one if the OR REPLACE clause is given. This statement was added in MySQL 5.0.1. If the view does not exist, CREATE OR REPLACE VIEW is the same as CREATE VIEW. If the view does exist, CREATE OR REPLACE VIEW is the same as ALTER VIEW.

关于sql - 如果不存在则创建 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3316950/

相关文章:

php - 如何从table1中选择还没有付款条目的记录?

php - 我应该从表中删除行还是禁用该行

php - SQL查询: Grouping results from two tables

php - 如何使用uploadify避免sql插入重复进行多图片上传

javascript - 使用 AngularJS 在 div 元素中显示表格的行

android:按下按钮并跟随手势

asp.net - 如何从我的 View (aspx 页面)中访问 ModelState?

sql - 在 SQL 中查找相应的行或获取下一行

mysql - 从 SQL 日期时间格式中提取小时数?

MySQL 一个查询中多个键的最新行