2017年2月6日
摘要: import random x = int(input('Enter a number for x: ')) --随机数最小值y = int(input('Enter a number for y: ')) --随机数最大值 n = int(input('How many numbers do yo 阅读全文
posted @ 2017-02-06 20:24 john2017 阅读(2026) 评论(0) 推荐(0) 编辑
摘要: --raise >>> raise IOError('This is a test!') Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> raise IOError('This is a test! 阅读全文
posted @ 2017-02-06 20:14 john2017 阅读(117) 评论(0) 推荐(0) 编辑
摘要: >>> class Person: def __init__(self, name, age): self.name = name self.age = age def display(self): print(self.name, self.age) >>> p = Person('john', 阅读全文
posted @ 2017-02-06 20:13 john2017 阅读(125) 评论(0) 推荐(0) 编辑
摘要: os.getcwd() 表示当前目录,可以换成其他目录路径 --返回当前目录中的文件夹和文件 >>> import os >>> os.listdir(os.getcwd()) ['01成品代码', '@test.py', 'addtofile1.py', 'class.py', 'class1.p 阅读全文
posted @ 2017-02-06 20:12 john2017 阅读(151) 评论(0) 推荐(0) 编辑
摘要: --设置字符串格式 >>> x = 0.123456789 >>> print('value : %.2f' % x) value : 0.12 >>> >>> x = 0.123456789 >>> y = 0.123456789 >>> print('x = %.2f y = %.3f' % ( 阅读全文
posted @ 2017-02-06 20:11 john2017 阅读(274) 评论(0) 推荐(0) 编辑
摘要: >>> i = 0 >>> while i < 10: print(i) i = i + 1 0 1 2 3 4 5 6 7 8 9 阅读全文
posted @ 2017-02-06 20:08 john2017 阅读(109) 评论(0) 推荐(0) 编辑
摘要: # if.py pwd = input('What is the password? ') if pwd == 'apple': print('Logging on ...') else: print('Incorrect password.') 运行结果: >>> What is the pass 阅读全文
posted @ 2017-02-06 20:07 john2017 阅读(107) 评论(0) 推荐(0) 编辑
摘要: >>> for i in range(5): print(i) 0 1 2 3 4 >>> for i in range(0, 5): print(i) 0 1 2 3 4 >>> for i in range(1, 5): print(i) 1 2 3 4 >>> for i in range(5 阅读全文
posted @ 2017-02-06 20:07 john2017 阅读(86) 评论(0) 推荐(0) 编辑
摘要: --type命令 >>> type(5) <class 'int'> >>> type(5.0) <class 'float'> >>> type('abc') <class 'str'> >>> type(None) <class 'NoneType'> --序列 字符串、元组、列表 正索引从0开 阅读全文
posted @ 2017-02-06 20:00 john2017 阅读(115) 评论(0) 推荐(0) 编辑
摘要: --查看内存相关参数SYS@ test10g> col name for a30SYS@ test10g> col value for a20SYS@ test10g> select name, value from v$parameter where name in('sga_max_size', 阅读全文
posted @ 2017-02-06 19:56 john2017 阅读(448) 评论(0) 推荐(0) 编辑
摘要: --内存分配建库时可以先分配系统内存的50%-80%给Oracle,后期根据业务再进行调整。SGA、PGA分配比例:OLTP:SGA %80 , PGA %20OLAP:SGA %50 , PGA %50混合:SGA %60 , PGA %40 --sga自动管理statistics_level 值 阅读全文
posted @ 2017-02-06 19:55 john2017 阅读(243) 评论(0) 推荐(0) 编辑
摘要: --查看执行计划方法1、关于Autotrace几个常用选项的说明:SET AUTOTRACE OFF -- 不生成AUTOTRACE 报告,这是缺省模式SET AUTOTRACE ON -- 包含执行计划和统计信息SET AUTOTRACE ON EXPLAIN -- AUTOTRACE只显示优化器 阅读全文
posted @ 2017-02-06 19:54 john2017 阅读(327) 评论(0) 推荐(0) 编辑
摘要: --得到所有表空间的ddl语句 SELECT DBMS_METADATA.GET_DDL('TABLESPACE', TS.tablespace_name)FROM DBA_TABLESPACES TS; --得到所有创建用户的ddl语句 SELECT DBMS_METADATA.GET_DDL(' 阅读全文
posted @ 2017-02-06 19:52 john2017 阅读(5437) 评论(0) 推荐(0) 编辑
摘要: merge into copy_emp1 c using employees e on (c.employee_id=e.employee_id)when matched then update set c.first_name=e.first_name, c.last_name=e.last_na 阅读全文
posted @ 2017-02-06 19:51 john2017 阅读(1144) 评论(0) 推荐(0) 编辑
摘要: SELECT first_name, last_nameFROM employeesWHERE REGEXP_LIKE (first_name, '^Ste(v|ph)en$'); FIRST_NAME LAST_NAME Steven KingSteven MarkleStephen Stiles 阅读全文
posted @ 2017-02-06 19:51 john2017 阅读(2336) 评论(0) 推荐(0) 编辑
摘要: --with 重用子查询对于多次使用相同子查询的复杂查询语句来说,用户可能会将查询语句分成两条语句执行。第一条语句将子查询结果存放到临时表,第二条查询语句使用临时表处理数据。从 Oracle 9i 开始,通过 with 子句可以给予子查询指定一个名称,并且使得在一条语句中可以完成所有任务,从而避免了 阅读全文
posted @ 2017-02-06 19:50 john2017 阅读(817) 评论(0) 推荐(0) 编辑
摘要: --合并(UNION、UNION ALL) select * from empwhere ename like '%A%'unionselect * from empwhere ename like '%M%' UNION ALL不会取消重复和排序 --和合并效果一样 select * from e 阅读全文
posted @ 2017-02-06 19:49 john2017 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1、嵌套循环联结(NESTED LOOPS)2、哈希联结(HASH JOIN)3、排序合并联结(MERGE JOIN)4、半联结(in/exists)5、反联结(not in/not exists)6、笛卡儿联结(MERGE JOIN CARTESIAN)7、外连联结 left outer join 阅读全文
posted @ 2017-02-06 19:48 john2017 阅读(2240) 评论(0) 推荐(0) 编辑