使用with子句和视图有什么区别 [英] What is the difference between using with clause and view

查看:1084
本文介绍了使用with子句和视图有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我在SQL Server 2012中使用'With Clause'和'View'时感到困惑,需要一个例子和这两者之间的区别。



我尝试了什么:



我尝试了两种但是Dunno在什么情况下我们可以使用这些?

Hi All.
I have a confusion in using 'With Clause' and 'View' in SQL Server 2012,and Need an example and difference between these two.

What I have tried:

I have tried both But Dunno in what scenario we can use these?

推荐答案

开始阅读MSDN文档:

SELECT - SQL命令 - WITH子句 [ ^ ]

视图 [ ^ ]

你会发现很多例子,你可以列出所有的差异。



这里列出的基本差异很少:

SQL视图和WITH子句之间的差异 - 堆栈溢出 [ ^ ]
Start reading MSDN documentation:
SELECT - SQL Command - WITH Clause[^]
Views[^]
There you'll find tons of examples and you'll be able to list all differences.

Few basic differences were listed here:
Difference between SQL View and WITH clause - Stack Overflow[^]


SQL views和条款非常相似。



一些差异

视图是数据库对象, WITH 是DML中使用的子句。

查看在数据库中创建实际对象,使用语句只是单个查询的一部分。
SQL views and with clauses are very similar to each other.

Some difference
VIEW is a database object, WITH is a clause that is used in DML.
View create an actual object in the database, With statements are only part if a single query.


这篇关于使用with子句和视图有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆