实验报告讲评.ppt

  1. 1、本文档共11页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实验报告_1讲评 文件名称不规范 邮件主题不规范 实验报告上要按要求输入报告者的个人信息 截图尽量美观 Chapter 3 复杂查询与数据修改 1. 复习:distinct、null、 between、order by、 列别名 。 2. Insert/update/delete的用法。 3. 汇总函数的用法:max/min/sum/avg/count。 4. Group by的用法。 5. Having子句。 6. 子查询(实验课上补充)。 insert 用于向表添加一条记录。 语法格式分为两种形式: insert into tab_name values(……) insert into tab_name(……) values(……) 第一种用于:添加的数据包含所有字段。 第二种用于:添加的数据不包含所有字段。 这里要注意字段的顺序。 delete 用于删除表中的记录,根据where子句中的条件,可以删除多条,where子句的用法与select语句的用法相同。 语法: delete from tab_name where …… 注意:如果不加where条件,delete语句会把表中的记录全部删除。 update 用于修改表中的记录,根据where子句中的条件,可以修改多条记录。 语法: update tab_name set col_name=…… where …… 注意:不加where条件,则会修改表中的 所有记录 汇总函数 主要用于查询表中某个字段的最大值、平均值、最小值、和、个数,其用法基本相同。对应的5个函数分别为: max、min、avg、sum、count 注意: count及sum、avg函数中的distinct用法。 汇总函数对NULL值的处理--均略去。 另外除了这几种特殊的汇总函数之外,各种DBMS一般也都提供了其他处理数值、字符串、时间的函数。 Group by 用于对汇总函数的分组查询,如查询emp表中,10号部门的sal的平均值。 注意: All column names in the SELECT list must appear in the GROUP BY clause unless the name is used only in an aggregate function. The contrary is not true, there may be column names in the GROUP BY clause that do not appear in the SELECT list. having 主要用于对group by子句的查询结果进行过滤。 语法:用于group by子句之后。 Having与where的区别 When where clause is used with GROUP BY, the where clause is applied first, then groups are formed from the remaining rows that satisfy the search condition. The WHERE clause filters individual rows going into the final result table, whereas HAVING filters groups going into the final result table. Having与where的区别 The ISO standard requires that column names used in the HAVING clause must also appear in the GROUP BY list or be contained within an aggregate function. Having与where的区别 In practice, the search condition in the HAVING clause always includes at leaset one aggregate function, otherwise the search condition could be moved to the WHERE clause and applied to individual rows. Remember that aggregate functions cannot be used in the WHERE clause

文档评论(0)

iris + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档