精华内容
下载资源
问答
  • Access查询SQL视图的切换
  • ADO操作AccessSQL 语句怎么用Access 查询设计的SQL 视图改造一下就能使用。
  • Access查询SQL Server中View的区别 虽然在Delphi当中两者都可以用Create View创建Drop View删除,但是两者并不相同 假设有表Book及booktype相关联生成查询视图)v_book 当book表中添加新字段时Access中的v_...

    Access中查询与SQL Server中View的区别

    虽然在Delphi当中两者都可以用Create View创建Drop View删除,但是两者并不相同

    假设有表Book及booktype相关联生成查询(视图)v_book

    当book表中添加新字段时Access中的v_book会自动更新,但SQL Server就可会中的视图不会自动更新 而且某些字段的类型还会出错,必须重建下

    转载于:https://www.cnblogs.com/jspdelphi/p/8986377.html

    展开全文
  • sql 视图嵌套视图 SQL | 观看次数 (SQL | Views) Views in SQL are virtual tables. A view also has rows and columns as they're during a real table within the database. We will create a view by selecting ...

    sql 视图嵌套视图

    SQL | 观看次数 (SQL | Views)

    Views in SQL are virtual tables. A view also has rows and columns as they're during a real table within the database. We will create a view by selecting fields from one or more tables present within the database. A View can either have all the rows of a table or specific rows supported under certain conditions. A view is nothing quite a SQL statement that's stored within the database with an associated name. A view is a composition of a table within the sort of a predefined SQL query. All rows of a table or select rows from a table can be contained inside the view. A view is often created from one or many tables which depend on the written SQL query to make a view.

    SQL中的视图是虚拟表视图还具有行和列,就像它们在数据库中的真实表中一样。 我们将通过从数据库中存在的一个或多个表中选择字段来创建视图。 视图可以具有表的所有行或在特定条件下受支持的特定行。 视图只不过是存储在数据库中且具有关联名称SQL语句。 视图是预定义SQL查询中的表的组成。 表的所​​有行或表中的选择行都可以包含在视图内部。 通常从一个或多个表创建视图,这些表取决于编写SQL查询来创建视图。

    Views, which are a kind of virtual tables allow users to try to the subsequent:

    视图是一种虚拟表,允许用户尝试以下操作:

    1. Structure data during a way that users or classes of users find natural or intuitive.

      在用户或用户类别觉得自然或直观的方式下构造数据。

    2. Restrict access to the info in such a way that a user can see and (sometimes) modify exactly what they have and no more.

      限制访问信息的方式,使用户可以看到和(有时)准确地修改自己拥有的内容,而不再修改。

    3. Summarize data from various tables which may be wont to generate reports.

      汇总来自各种表的数据,这些数据可能不会生成报告。

    Here we will discuss creating, deleting and updating views.

    在这里,我们将讨论创建,删除和更新视图。

    创建视图 (Creating the view)

    Views can be created in SQL by using the CREATE VIEW command. This order gives the name to the view and determines the rundown of credits and tuples to be incorporated utilizing a subquery.

    可以使用CREATE VIEW命令在SQL中创建视图 。 该顺序为视图指定名称,并使用子查询确定要合并的学分和元组的精简。

    The syntax to create a view is given here,

    这里给出了创建视图的语法,

    CREATE VIEW <view_name>
    As <subquery>;
    
    

    For example, the command to create a view containing details of books which belong to text-book and Language Book can be specified as:

    例如,用于创建包含教科书和语言书的书的详细信息的视图的命令可以指定为:

    CREATE VIEW Book_1
    As SELECT *
    FROM BOOK
    WHERE Category IN ('Textbook','LanguageBook');
    
    

    Output

    输出量

    SQL | View Example 1

    This command creates the view, named Book_1, having details of books satisfying the condition specified in the WHERE clause. The view created like this consists of all the attributes of Book relation also.

    此命令创建名为Book_1的视图,该视图具有满足WHERE子句中指定条件的书籍的详细信息。 这样创建的视图也包含Book关系的所有属性。

    For example, consider the command given below:

    例如,考虑以下命令:

    CREATE VIEW Book_2(B_code,B_title,B_category,B_price)
    As SELECT ISBN,Book_Tiltle,Category,Price
    FROM Book
    WHERE Category IN ('Textbook','LanguageBook');
    
    

    Output

    输出量

    SQL | View Example 2

    This command creates a view Book_2, which consists of the attributes, ispn, book-name, categori, and price from the relation Book with new names, namely, b_code, b_title, b_category, and b_price respectively. Now queries can be performed on these views as they are performed on other relations.

    此命令创建一个视图Book_2 ,该视图由关系Book中的属性ispn , book-name , categori和price组成,具有新名称,分别为b_code , b_title , b_category和b_price 。 现在,可以在这些视图上执行查询,就像在其他关系上执行查询一样。

    Consider the example given below:

    考虑下面给出的示例:

    SELECT *
    FROM Book_1;
    
    

    Output

    输出量

    SQL | View Example 3
    SELECT *
    FROM Book_2
    WHERE price>300;
    
    

    Output

    输出量

    SQL | View Example 4
    SELECT b_title, b_category
    FROM Book_2
    WHERE price BETWEEN 200 and 350;
    
    

    Output

    输出量

    SQL | View Example 5

    Views can contain more than one relation. The views that depend on more than one relation are known as complex views. These types of views are inefficient as they are time-consuming to execute, especially if multiple queries are involved in the view definition. Since their content is not physically stored, they are executed whenever their reference is done inside the program.

    视图可以包含多个关系。 依赖于多个关系的视图称为复杂视图 。 这些类型的视图效率低下,因为它们执行起来很耗时,尤其是在视图定义中涉及多个查询的情况下。 由于它们的内容不是物理存储的,因此只要在程序内部完成引用就可以执行它们。

    更新视图 (Updating Views)

    A view can be updated based upon several conditions as mentioned below,

    可以根据以下几种条件来更新视图,

    • Keyword DISTINCT should not be present in the SELECT statement.

      关键字DISTINCT不应出现在SELECT语句中。

    • The summary function should not be there in the SELECT statement.

      摘要函数不应在SELECT语句中存在。

    • Set function and Set Operations should not be present in the SELECT statement.

      设置函数和设置操作不应出现在SELECT语句中。

    • ORDER BY clause should not be present in the SELECT statement.

      SELECT语句中不应存在ORDER BY子句。

    • Multiple tables should not be contained in the FROM statement.

      FROM语句中不应包含多个表。

    • Subqueries should not be present inside the WHERE clause.

      子查询不应出现在WHERE子句中。

    • A query written in SQL must not contain GROUP BY or HAVING.

      用SQL编写的查询不得包含GROUP BYHAVING

    • Columns that are calculated may not get updated.

      计算的列可能不会更新。

    If the view satisfies the above-mentioned conditions then the user or programmer is able to update the view. The code written below can be used for serving the purpose.

    如果该视图满足上述条件,则用户或程序员可以更新该视图。 下面编写的代码可用于实现此目的。

    UPDATE <Name of VIEW>
    SET <parameter to be updated>=<value>
    WHERE <condition>;
    
    

    放下视图 (Dropping View)

    The view needs to be dropped (i.e. Deleted permanently) when not in further use. The syntax for doing so is,

    不使用该视图时,需要将其删除(即永久删除)。 这样做的语法是

    DROP VIEW <view_name>;
    
    
    

    翻译自: https://www.includehelp.com/sql/views.aspx

    sql 视图嵌套视图

    展开全文
  • sql 视图嵌套视图Hey folks! In this article we will ... 在本文中,我们将重点介绍SQL视图 。 什么是SQL视图? (What is a View in SQL?) In SQL, a View can be considered as virtual access to the database ...

    sql 视图嵌套视图

    Hey folks! In this article we will be focusing on SQL Views.

    嘿伙计! 在本文中,我们将重点介绍SQL视图

    什么是SQL视图? (What is a View in SQL?)

    In SQL, a View can be considered as virtual access to the database in a restricted manner. SQL Views allow limiting the view access to a specific set of data for a set of users. You can create a view with a limited amount of data from one or more tables and columns.

    SQL中 ,可以将View视为受限地对数据库的虚拟访问。 SQL视图允许将视图访问限制为一组用户对一组特定数据的访问。 您可以使用一个或多个表和列中的有限数量的数据创建视图。



    需要SQL视图 (Need of SQL Views)

    Views help the database administrator to provide restricted access to the tables of the database to other users/employees.

    视图可帮助数据库管理员向其他用户/雇员提供对数据库表的受限访问。

    For example, consider a website’s login database that contains the data columns as ‘User_id’, ‘Password’, ‘Phone_num’ and ‘Name’. In case, if the database administrator happens to provide access to the System’s Tester(employee), he can do so by providing restricted/limited access to the user through SQL Views. He can limit the database access by just providing access to data columns such as ‘Name’ and ‘User_id’.

    例如,考虑一个网站的登录数据库,其中包含数据列,如“ User_id”,“ Password”,“ Phone_num”和“ Name”。 万一数据库管理员碰巧提供对系统测试人员(员工)的访问权限,则可以通过SQL视图为用户提供受限/受限访问权限。 他可以通过仅提供对数据列(例如“名称”和“ User_id”)的访问来限制数据库访问。

    Thus, SQL Views helps in aligning the confidential data access through various restricted parameters.

    因此,SQL视图有助于通过各种受限参数调整机密数据访问。



    创建一个SQL视图 (Creating an SQL View)

    By creating a View, we decide the limit to provide access to the original database.

    通过创建视图,我们确定了提供对原始数据库的访问的限制。

    Syntax:

    句法:

    
    CREATE VIEW View_name AS
    SELECT columns
    FROM  Table;
    

    We use View alongside SELECT statement to select the data columns to be made visible to the user.

    我们在SELECT statement旁边使用View来选择要使用户可见的数据列。

    We have created a Table (using data from our previous tutorial on SQL sum, average, and count functions) – ‘Info’ as seen below with data columns — ‘id’, ‘Cost’, ‘city’, and ‘Password’.

    我们已经创建了一个表(使用上一教程中有关SQL求和,平均值和计数函数的数据 )–“信息”,如下所示,其中包含数据列-“ id”,“ Cost”,“ city”和“ Password”。

    
    id      Cost    city    Password
    1	100	Pune	11**&!
    2	50	Satara	1234$
    3	65	Pune	qwerty123@
    4	97	Mumbai	JAM1998#
    5	12	USA	0000%!
    

    Having created a Table, let us start with the creation of View on the database.

    创建表后,让我们开始在数据库上创建View。

    Example 1:

    范例1:

    
    CREATE VIEW Info_review AS
    SELECT cost, city
    FROM  Info;
    
    SELECT * from Info_review;
    

    We have created a View as ‘Info_review’ over the Table – ‘Info’ by providing access to the data of the columns ‘Cost’ and ‘city’ using the SELECT statement.

    我们已经通过使用SELECT语句提供对“成本”和“城市”列数据的访问,从而在表上创建了一个名为“ Info_review”的视图-“ Info”。

    Output:

    输出:

    
    100	Pune
    50	Satara
    65	Pune
    97	Mumbai
    12	USA
    

    Example 2:

    范例2:

    
    CREATE VIEW Info_review AS
    SELECT cost, city
    FROM  Info
    WHERE city = "Pune";
    SELECT * from Info_review;
    

    In this example, we have created a SQL View using SELECT statement and WHERE clause by restricting the access such that only those data values are made available that belong to the city ‘Pune’.

    在此示例中,我们通过限制访问权限使用SELECT statementWHERE clause创建了SQL视图,从而仅使属于城市“浦那”的那些数据值可用。

    Output:

    输出:

    
    100	Pune
    65	Pune
    


    更新SQL视图 (Updating an SQL View)

    Updation in a View means to update or manipulate the pre-defined records in the database.

    视图中的更新意味着更新或操作数据库中的预定义记录。

    We need to follow the below conditions in order to Update the data of a View:

    我们需要遵循以下条件才能更新视图的数据:

    • SQL SELECT statement should not be used alongside DISTINCT keyword and ORDER BY clause.

      SQL SELECT statement不应与DISTINCT关键字和ORDER BY子句一起使用。
    • SQL SELECT statement should not contain set operators, set functions, and summary functions.

      SQL SELECT语句不应包含集合运算符集合函数摘要函数
    • The View query should not be used alongside HAVING and GROUP BY clause.

      View查询不应与HAVINGGROUP BY子句一起使用。
    • The query should not use FROM clause to fetch data from multiple columns.

      该查询不应使用FROM clause从多个列中获取数据。
    • SQL View should contain all the NON-NULL values of the original database.

      SQL View应该包含原始数据库的所有NON-NULL values

    Syntax:

    句法:

    
    UPDATE View-name
       SET column="value"
       WHERE condition;
    

    Example:

    例:

    
    CREATE VIEW Info_review AS
    SELECT id, city
    FROM  Info;
    
    UPDATE Info_review
       SET city="Satara"
       WHERE id = 1;
    
    SELECT * from Info_review;
    

    In the above example, we have updated the city value whose id = 1.

    在上面的示例中,我们更新了ID = 1的城市值。

    Output:

    输出:

    
    1	Satara
    2	Satara
    3	Pune
    4	Mumbai
    5	USA
    

    Once an updation is made in the View, it immediately gets reflected in the table of the original database.

    一旦在视图中进行了更新,它就会立即反映在原始数据库的表中。

    
    SELECT * from Info;
    

    If we execute the above SELECT statement, we can see that the updation made in the View of id = 1 is reflected in the original Table – ‘Info’.

    如果执行上面的SELECT语句,我们可以看到在id = 1的视图中进行的更新反映在原始表–“信息”中。

    
    1	100	Satara	11**&!
    2	50	Satara	1234$
    3	65	Pune	qwerty123@
    4	97	Mumbai	JAM1998#
    5	12	USA	0000%!
    


    从SQL视图删除行 (Deletion of rows from SQL Views)

    Data rows can be deleted from SQL View by using the below command:

    可以使用以下命令从SQL View中删除数据行:

    
    DELETE FROM View-name
       WHERE column= "value";
    

    Example:

    例:

    
    create table Info(id integer, Cost integer, city varchar(200),Password varchar(200));
    insert into Info(id, Cost,city,Password) values(1, 100,"Pune","11**&!");
    insert into Info(id, Cost,city,Password) values(2, 50, "Satara","1234$");
    insert into Info(id, Cost,city,Password) values(3, 65,"Pune","qwerty123@");
    insert into Info(id, Cost,city,Password) values(4, 97,"Mumbai","JAM1998#");
    insert into Info(id, Cost,city,Password) values(5, 12,"USA","0000%!");
    
    CREATE VIEW Info_review AS
    SELECT id, city
    FROM  Info;
    
    DELETE FROM Info_review
       WHERE city = "USA";
    
    SELECT * from Info_review;
    
    

    Output:

    输出:

    
    1	Pune
    2	Satara
    3	Pune
    4	Mumbai
    

    Changes made in the View are reflected in the original table as seen below.

    在视图中所做的更改将反映在原始表中 ,如下所示。

    
    SELECT * from Info;
    
    
    1	100	Pune	11**&!
    2	50	Satara	1234$
    3	65	Pune	qwerty123@
    4	97	Mumbai	JAM1998#
    

    As you may notice, the row containing USA is no longer available in both, the view and the original table.

    您可能会注意到,视图和原始表中都不再包含USA的行。



    在SQL视图中插入一行 (Insertion of a row in SQL Views)

    Insertion of a data row in SQL View should follow all the conditions mentioned in the Updation of View section.

    在SQL视图中插入数据行应遵循“更新视图”部分中提到的所有条件。

    Syntax:

    语法

    
    INSERT into View-name(columns) values(val1,..,valN)
    

    Example:

    例:

    
    INSERT into Info_review(id,city) values(12,'France');
    
    SELECT * from Info_review;
    

    Output:

    输出:

    
    1	Pune
    2	Satara
    3	Pune
    4	Mumbai
    5	USA
    12	France
    

    All the changes made in the SQL View are reflected in the original table as shown below.

    SQL视图中所做的所有更改都反映在原始表中,如下所示。

    
    SELECT * from Info;
    
    
    1	100	Pune	11**&!
    2	50	Satara	1234$
    3	65	Pune	qwerty123@
    4	97	Mumbai	JAM1998#
    5	12	USA	0000%!
    12	NULL	France	NULL
    


    删除SQL视图 (Dropping an SQL View)

    If we wish to delete the entire View along with the data and its schema, we need to use Drop statement.

    如果我们希望删除整个View以及数据及其架构,则需要使用Drop语句。

    The Drop statement deletes the entire View from the memory along with its structure(schema).

    Drop statement从内存中删除整个View及其结构(模式)。

    Syntax:

    句法:

    
    DROP VIEW View-name;
    

    Example:

    例:

    
    DROP VIEW Info_review;
    

    Having deleted the View, we can use the below SELECT statement to verify its deletion.

    删除视图后,我们可以使用下面的SELECT语句来验证其删除。

    
    Select * from Info_review;
    

    Output:

    输出:

    
    ERROR 1146 (42S02) at line 15: Table 'test.Info_review' doesn't exist
    


    结论 (Conclusion)

    By this, we have come to the end of this topic. I believe that the concept is clear to all the readers.

    至此,我们到了本主题的结尾。 我相信所有读者都清楚这个概念。

    Please feel free to comment in case you come across a doubt.

    如果您有任何疑问,请随时发表评论。



    参考资料 (References)

    翻译自: https://www.journaldev.com/40677/sql-views

    sql 视图嵌套视图

    展开全文
  • 打开Access中的SQL视图

    千次阅读 2009-01-14 11:37:00
    打开Access中的SQL视图,连接。
     打开Access中的SQL视图,
    连接
    展开全文
  • access2007中使用sql视图设置

    千次阅读 2012-07-05 16:03:17
    1, 点击创建菜单(Create) 2,选择查询设计(QueryDesign) 3,添加表, 右键点击, 选择sql视图 4,或点击菜单Home,在view的下拉框中选择
  • 由于Access数据库的查询分析(SQL视图)太鸡肋了!!!所以编写了此程序。 XDBHelper是一款数据库查询分析器,可通过ODBC方式操作SQLServer/Oracle/DB2/Sybase/MySQL/Access等等数据库,并可将数据导出为CSV文件。...
  • 本人想把一access数据库升迁为sql server数据库,升迁过程中数据表和查询全部都生成了SQL表,这样我就试着手动将“查询”转换成“视图”,遇到了一问题: 下面这个access查询语句在access里面生成的查询表总共有...
  • 1、打开一个Access数据库文件 ...4、点击左上角的“SQL视图”,这时就可在查询窗中输入SQL语句了 5、SQL语句编辑完成后,点击左上角的红色感叹号即可执行SQL语句 https://zhidao.baidu.com/que...
  • Access中使用sql查询

    2016-01-07 16:58:15
    ACCESS中使用SQL查询语句检查SQL语法时非常有用。 操作步骤如下: 【创建】->... 找到【SQL视图】: 在查询命令窗口输入命令,然后执行运行命令。 提示语句: S...
  • Access执行sql 查询

    2014-04-29 13:22:10
    ACESS2007 1. 点击“创建”--点击 “查询设计”
  • 关键词:import access view to sql 2000 or 2005在把access 中的视图导入sql server 2000 or 2005时遇到的问题先google ,baidu ,都没找到资料。有轻率的人建议把access里的脚本复制到 server 再执行就行了。实际...
  • ACCESS 建立视图

    千次阅读 2006-04-10 09:29:00
    建立建立一个模块。然后写以下代码。在运行 Sub runsqltring() CurrentProject.Connection.Execute "create view sss as select * from asd"End ...但是 ACCESS 2000好象看不到所创建的视图。但是可以在SQL语句中访问
  • access/sql跨库查询

    2010-01-09 10:42:00
    昨天偶然的一个机会接触...(是数据库而不是表哦)目前web开发用的较多的数据库莫过于access,sqlserver。sqlserver占多数。先来讲讲access跨库查询:假设有两个access数据库分别为A.mdb和B.mdb,A.mdb有”学校“表单,B.
  • 定义word、dword其实主要是为了:1)便于移植,2)更为严格德类型检查。 word固定是2字节,dword固定是4字节。而int则不是,它随着操作系统的不同,可以有不一样的字节数。如在dos和windows 3.x等16位操作系统下,...
  • 选择 创建/查询向导/简单查询向导 后 ,点击确定。
  • Access Sql大全

    千次阅读 2010-03-23 23:56:00
    --语 句 功 能--数据操作SELECT --从数据库表中检索数据行和列INSERT --向数据库表添加新数据行DELETE --从数据库表中删除...-从数据库中删除表ALTER TABLE --修改数据库表结构CREATE VIEW --创建一个视图DROP VIEW --
  • Access中提供查询对象,在设计时可以采用设计视图和SQL视图,非常方便,SQL视图中的SQL语句可以在SQL SERVER中使用,但是否完全可用呢?答案是否定的,表中总结了 Microsoft Access 和 Microsoft SQL Servers 的...
  • Access数据库中使用SQL查询分析器

    千次阅读 2011-01-14 18:15:00
     Access数据库常被用于存储本地结构化数据。 因开发或管理的需要有时需要用sql语句分析数据。 但用access自己的向导用... 在新建查询中选择设计视图    3. 然后在新建查询的上半区域右击, 选中
  • accessSQL有什么不同

    千次阅读 2012-09-27 16:07:22
    Access中提供查询对象,在设计时可以采用设计视图和SQL视图,非常方便,SQL视图中的SQL语句可以在SQL SERVER中使用,但是否完全可用呢?答案是否定的,表1中总结了 Microsoft Access 和 Microsoft SQL Servers 的 ...
  • v$sql和v$sqlarea视图:  v$sqlarea和v$sql两个视图的不同之处在于,v$sql中为每一条SQL保留一个条目,而v$sqlarea中... v$sql视图列举了共享SQL区(Shared SQL Area)中的SQL统计信息,这个视图中的信息未经分组
  • Access查询中执行SQL语句

    千次阅读 2008-06-02 10:14:00
    如何在Access查询中输入自己的SQL语句? --> 打开你的MDB --> 在数据库窗口中,点击“查询”,或在“视图”菜单中选择“数据库对象”-> “查询” --> 点击数据库窗口中的“新建”按钮 --> 点击“确定”,关闭“显示...
  • AccessSQL2000

    2009-03-24 16:57:37
    生成升迁 SQL脚本,保存为 *.sql文件后,SQL2000的查询分析器里调入执行 生成升迁 ASP脚本,这样你可以用该脚本和相应MDB数据库上传到服务器在线升迁 直接执行Access数据导入到SQL2000服务器(表结构和数据) V1.03 ...
  • AccessSQL视图中试验没有任何问题,工作一切正常。于是将SQL语句写入到C#程序中,结果一到查询语句时就出错跳出,百思不得其解。于是查找Access帮助文件,找到如下帮助: ////////////////////////////////...
  • ORACLE如何在有视图SQL中使用hint(提示)来设置视图内的SQL查询方式oracle的hint(提示)我想大家都知道使用吧,如果这个没用的话那就不用往下看了。本文主要介绍ORACLE如何在有视图SQL中使用hint(提示)来设置视图...
  • sql语句查询:sql server和access 数据库里的所有表名,字段名  sql语句查询:sql server和access 数据库里的所有表名,字段名 SQL SERVER 查看所有表名: select name from sysobjects where type='U'...
  • SQL SERVER  查看所有表名: select name from sysobjects where type='U' 查询表的所有字段名: Select name from syscolumns Where ID=OBJECT_ID('表名') select * ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 50,140
精华内容 20,056
关键字:

accesssql视图查询