|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
列举选择MySQL的理由的最困难的地方在于,如何对这些理由进行排序。MySQL学习教程这就如同我们经常争论的故事:先有鸡还是先有蛋?oracle
在DB2中怎样FOracle的相P功效(二)
作者sCCBZZP
在F的弥写蠹铱赡芙常龅皆DB2中怎样FOracle的某些功效o
在此我蔚乜Y一下oF某一功效大概泻芏喾N办法o在此就]有全体列出o
g迎人人^mo以便和人人共享o配合探o配合近步u(以下次要以Oracle
8I,9I和DB27.X槔)。
1.怎样检察稻的版本的Oracle和DB2的法
Oracle能够@Fs
SQL>connectsystem/manager124@test;
已B.
SQL>select*fromv$version;
BANNER
----------------------------------------------------------------
Oracle9iEnterpriseEditionRelease9.2.0.1.0-Production
PL/SQLRelease9.2.0.1.0-Production
CORE9.2.0.1.0Production
TNSfor32-bitWindows:Version9.2.0.1.0-Production
NLSRTLVersion9.2.0.1.0-Production
DB2能够@Fs
在命令窗口绦db2level
D:QLLIBBIN>db2level
DB210851Instance"DB2"usesDB2coderelease"SQL07020"withlevelidentifier
"03010105"andinformationaltokens"DB2v7.1.0.40","n010415"and"WR21254".
2.怎样疾速清空一年夜表的Oracle和DB2的法
Oracle能够@Fs
SQL>truncatetabletable_name;
DB2能够@Fs
altertabletable_nameactivenotloggedinitiallywithemptytable;
3.怎样检察表空g的利用r的Oracle和DB2的法
Oracle能够@Fs
SELECTtablespace_name,max_m,count_blocksfree_blk_cnt,sum_free_m,to_char(100*sum_free_m/sum_m,99.99)||%AS
pct_free
FROM(SELECTtablespace_name,sum(bytes)/1024/1024ASsum_mFROMdba_data_filesGROUPBYtablespace_name),
(SELECTtablespace_nameASfs_ts_name,max(bytes)/1024/1024ASmax_m,count(blocks)AScount_blocks,
sum(bytes/1024/1024)ASsum_free_mFROMdba_free_spaceGROUPBYtablespace_name)
WHEREtablespace_name=fs_ts_name
DB2能够@Fs
listtablespacecontainersfor你的表空gshowdetail;
4.怎样一rgc掏出日期的各部分的经常使用的Oracle和DB2的法
Oracle能够@Fs
1>.取rgc的年份的法:
SELECTTO_CHAR(SYSDATE,YYYY)FROMDUAL;
2>.取rgc的月份的法:
SELECTTO_CHAR(SYSDATE,MM)FROMDUAL;
3>.取rgc的日的法:
SELECTTO_CHAR(SYSDATE,DD)FROMDUAL;
4>.取rgc的r的法:
SELECTTO_CHAR(SYSDATE,HH24)FROMDUAL;
5>.取rgc的分的法:
SELECTTO_CHAR(SYSDATE,MI)FROMDUAL;
6>.取rgc的秒的法:
SELECTTO_CHAR(SYSDATE,SS)FROMDUAL;
7>.取rgc的毫秒的法:(9I以上)
selectSUBSTR(systimestamp,20,6)fromdual;
8>.取rgc的日期的法:
SELECTTRUNC(SYSDATE)FROMDUAL;
9>.取rgc的rg的法:
SELECTTO_CHAR(SYSDATE,HH24:MI:SS)FROMDUAL;
10>.日期,rg形B樽址B
SELECTTO_CHAR(SYSDATE)FROMDUAL;
11>.⒆址DQ成日期或rg形B:
SELECTTO_DATE(2003/08/01)FROMDUAL;
12>.前往档男瞧诩傅法:
SELECTTO_CHAR(SYSDATE,D)FROMDUAL;
13>.前往狄荒曛械牡诩柑斓法:
SELECTTO_CHAR(SYSDATE,DDD)FROMDUAL;
14>.前往半夜和抵兄付ǖrg值之g的秒档法:
SELECTTO_CHAR(SYSDATE,SSSSS)FROMDUAL;
15>.前往抵幸荒甑牡诩钢艿法:
SELECTTO_CHAR(SYSDATE,WW)FROMDUAL;
DB2能够@Fs
1>.取rgc的年份的法:
SELECTYEAR(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
2>.取rgc的月份的法:
SELECTMONTH(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
3>.取rgc的日的法:
SELECTDAY(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
4>.取rgc的r的法:
SELECTHOUR(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
5>.取rgc的分的法:
SELECTMINUTE(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
6>.取rgc的秒的法:
SELECTSECOND(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
7>.取rgc的毫秒的法:
SELECTMICROSECOND(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
8>.取rgc的日期的法:
SELECTDATE(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
9>.取rgc的rg的法:
SELECTTIME(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
10>.日期,rg形B樽址B:
SELECTchar(currentdate)FROMSYSIBM.SYSDUMMY1;
SELECTchar(currenttime)FROMSYSIBM.SYSDUMMY1;
SELECTchar(currentdate+12hours)FROMSYSIBM.SYSDUMMY1;
11>.⒆址DQ成日期或rg形B:
SELECTTIMESTAMP(2002-10-20-12.00.00.000000)FROMSYSIBM.SYSDUMMY1;
SELECTTIMESTAMP(2002-10-2012:00:00)FROMSYSIBM.SYSDUMMY1;
SELECTDATE(2002-10-20)FROMSYSIBM.SYSDUMMY1;
SELECTDATE(10/20/2002)FROMSYSIBM.SYSDUMMY1;
SELECTTIME(12:00:00)FROMSYSIBM.SYSDUMMY1;
SELECTTIME(12.00.00)FROMSYSIBM.SYSDUMMY1;
12>.前往档男瞧诩傅法:
SELECTDAYNAME(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
SELECTDAYOFWEEK(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
SELECTDAYOFWEEK_ISO(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
13>.前往狄荒曛械牡诩柑斓法:
SELECTDAYOFYEAR(currenttimestamp)FROMSYSIBM.SYSDUMMY1;
14>.前往半夜和抵兄付ǖrg值之g的秒档法:
SELECTMIDNIGHT_SECONDS(currenttimestamp)FORMSYSIBM.SYSDUMMY1;
15>.前往抵幸荒甑牡诩钢艿法:
SELECTWEEK(currenttimestamp)FORMSYSIBM.SYSDUMMY1;
待m...
用户时常会发现其实自己并不是第一个选用MySQL数据库的先驱者。” |
|