首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

学习python第三天之多行函数

多行函数:(聚合函数/分组函数) 解释:多条数据进入,单条结果出来(多进单出) 1).max(obj):最大值 2).min(obj):最小值 3).sum(num):求和 4).avg(num):求平均值 5).count(obj):计数 【注意事项】: 1).max()和min()两个函数可以接受任何数据类型的实际参数 2).sum()和avg()两个函数只能接受number类型的数据 3).多行函数/聚合函数/分组函数满足自动忽略空值的特点(在某些情况下,我们不应该忽略空值...) 案例如下: 查询公司薪资最高的、最低的、工资总和以及平均值的信息? select max(salary),min(salary),sum(salary),avg(salary) from employees; 参看如下代码并思考: select max(last_name),max(hire_date),min(last_name),min(hire_date) from employees; 关于count()的使用: 需求如下: 查询公司有多少员工? select count(employee_id),count(last_name),count(hire_date) from employees; select count(1),count(2),count(0),count(107),count('*') from employees; 执行以上代码发现效果都是正确的,我们以后做计数操作的时候,我们都用count('*')来实现; 查看如下代码: select count(department_id),count(commission_pct) from employees; 执行以上代码发现问题所在,只要是多行函数/聚合函数/分组函数满足自动忽略空值的特点 修改以上代码实现需要的效果: select count(nvl(department_id,100)),count(nvl(commission_pct,1)) from employees; 思考:avg() = sum() / count()? 答:以上的等式成立 需求如下: 查询公司的平均奖金率? select avg(commission_pct),sum(commission_pct) / count(commission_pct), sum(commission_pct) / count(nvl(commission_pct,2)), sum(commission_pct) / 107, sum(commission_pct) / count(*) from employees; 作业: --1.显示系统时间(注:日期+时间) select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') from dual; --2.查询员工号,姓名,工资,以及工资提高百分之20%后的结果(new salary) select employee_id,last_name,salary,salary * 1.2 "new salary" from employees; --3.将员工的姓名按首字母排序,并写出姓名的长度(length) select last_name,length(last_name) from employees order by last_name; --4.查询各员工的姓名,并显示出各员工在公司工作的月份数(worked_month)。 select last_name,round(months_between(sysdate,hire_date),0) "worked_month" from employees; --5.查询员工的姓名,以及在公司工作的月份数(worked_month),并按月份数降序排列 select last_name,round(months_between(sysdate,hire_date),0) "worked_month" from employees order by "worked_month" desc; --方式一: select last_name || ' earns $' || salary || ' monthly but wants $' || 3 * salary "Dream Salary" from employees; --方式二: select last_name || ' earns' || to_char(salary,'$99999') || ' monthly but wants' || to_char(3 * salary,'$99999') "

01

最新iOS设计规范五|3大界面要素:控件(Controls)

iOS是运行于iPhone、iPad和iPod touch设备上、最常用的移动操作系统之一。作为互联网应用的开发者、产品经理、体验设计师,都应当理解并熟悉平台的设计规范。这有利于提高我们的工作效率,保证用户良好的体验。 本文是iOS设计规范系列第5篇,介绍3大界面要素(栏、视图、控件)中的控件(Controls)。首先让我们回顾一下iOS的3大界面要素。 3大界面要素 (Interface Essentials) 大多数iOS应用都是由UI Kit中的组件构建的。UI Kit是一种定义通用界面元素的编程框架,这个框架不仅让APP在视觉外观上保持一致,同时也为个性化设计留有很大空间。UI Kit提供的界面组件有三类:栏(Bars),视图(Views),控件(Controls)。

03

Python3 获取文件属性的方式(时间、大小等)

st_mode: inode 保护模式 -File mode: file type and file mode bits (permissions). st_ino: inode 节点号。 -Platform dependent, but if non-zero, uniquely identifies the file for a given value of st_dev. ——the inode number on Unix, ——the file index on Windows st_dev: inode 驻留的设备。 -Identifier of the device on which this file resides. st_nlink:inode 的链接数。 -Number of hard links. st_uid: 所有者的用户ID。 -User identifier of the file owner. st_gid: 所有者的组ID。 -Group identifier of the file owner. st_size:普通文件以字节为单位的大小;包含等待某些特殊文件的数据。 -Size of the file in bytes, if it is a regular file or a symbolic link. The size of a symbolic link is the length of the pathname it contains, without a terminating null byte. st_atime: 上次访问的时间。 -Time of most recent access expressed in seconds. st_mtime: 最后一次修改的时间。 -Time of most recent content modification expressed in seconds. st_ctime:由操作系统报告的”ctime”。在某些系统上(如Unix)是最新的元数据更改的时间,在其它系统上(如Windows)是创建时间(详细信息参见平台的文档)。 st_atime_ns -Time of most recent access expressed in nanoseconds as an integer st_mtime_ns -Time of most recent content modification expressed in nanoseconds as an integer. st_ctime_ns -Platform dependent: ——the time of most recent metadata change on Unix, ——the time of creation on Windows, expressed in nanoseconds as an integer.

01
领券