zoukankan      html  css  js  c++  java
  • sql视图

    为什么要使用视图:
    简化复杂的SQL操作,在编写查询后,可以方便地重用它而不必知道其基本查询细节。
    使用表的一部分而不是整个表。
    保护数据,可以授予用户访问表的特定部分的权限,而不是整个表的访问权限。
    更改数据格式和表示。视图可返回与底层表的表示和格式不同的数据。

    创建视图
    create view newspaper as
    select n.n_id,n.n_title,t.t_id
    from nrc_news as n,nrc_type as t
    where n.t_id=t.t_id;
    检索数据
    select * from newspaper
    where t_id=10;

    使用视图格式化检索出的数据
    select rtrim(n_title)+'('+RTRIM(t_id)+')' as news from newspaper
    where t_id=10;

    create view topID10 as
    select rtrim(n_title)+'('+RTRIM(t_id)+')' as news from newspaper
    where t_id=10;
    使用视图进行计算
    select n_id,t_id,n_id*t_id as value from newspaper

  • 相关阅读:
    php验证码
    php上传
    ajax的用法 资料
    ajax如何使用
    AJAX
    基础概念梳理 :
    ICompare 可比较接口
    强类型 和弱类型 c#
    .ne 基础(2)
    .net 基础(一)
  • 原文地址:https://www.cnblogs.com/daochong/p/4871627.html
Copyright © 2011-2022 走看看