资源描述:
《Oracle基础知识及例子》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、数据库类型:小型:Accessfoxbase中型:MySqlSQLServer大型:DB2OracleSybaseOcaOracle初级认证OcpOracle专家级认证OcmOracle大师级认证Oracle创始人:劳伦斯埃里森1970做数据库起家Oracle9i2002年Oracle10g2003年Oracle11g2007年Oracle管理工具:sqlplus账号:user1-user19口令同上recruitsql语句:DDL:DataDefinitionLanguagecreatedro
2、palterdesc/describeDML:DataManipulationLanguageInsertdeleteupdate更新select命令行:isqlplusctlstart启动isqlplus服务select语句select*fromexternalcandidate;selectvfirstname,vlastname,ccityfromexternalcandidate;selectvfirstname
3、
4、''
5、
6、vlastnameasname,ccityascityfrome
7、xternalcandidate;查看表中唯一的值SELECTDISTINCTcolumn_nameFROMtablenameWhere字句select*fromcollegewherecstate='California';选择年龄比23-11月-67大的所有应聘者的所有信息descexternalcandidate;select*fromexternalcandidatewheredbirthdate>'23-11月-67';selectsysdatefromdual;select*from
8、dual;select99*5fromdual;模糊查询:likeselectcnewspapernamepaper,vcontactpersonperson,cphonephonefromnewspaperwherevcontactpersonlike'%Jackson%';%表示任意字符数_表示一个字符数ISNULL关键字:用来检查表中是否包含NULL值的空白列或行.语法SELECTselect_listFROMtablenameWHEREcolumn_nameISNULL;descposi
9、tion;select*fromposition;select(NBUDGETEDSTRENGTH-NCURRENTSTRENGTH)needfrompositionwherecpositioncode='0001';select*frompositionorderbycpositioncodedesc;(降序)单行函数:selectinitcap('jack')fromdual;selectupper(vfirstname)fromexternalcandidate;selectlower(v
10、firstname)fromexternalcandidate;selectltrim('helloworld','hello')fromdual;selectrtrim('helloworld','hello')fromdual;ltrim(char,set):从char左侧开始比较。如果在set中出现,则删除,否则就停止。selectconcat('hello','worldssss')fromdual;selectsubstr('helloworld',2,4)fromdual;selec
11、tinstr('helloworld','e')fromdual;selectlpad(1000,7,'$')fromdual;selectrpad(1000,7,'$')fromdual;selectlength('helloworld')fromdual;selectvfirstname,vlastname,round(ntestscore,1)fromexternalcandidatewherenTestscore>70;selectround(123.456,-2)fromdual;se
12、lectabs(-9)fromdual;selectceil(12.3)fromdual;selectfloor(12.3)fromdual;selectpower(5,3)fromdual;selecttrunc(123.756,2)fromdual;selectsqrt(81)fromdual;selectmod(11,-3)fromdual;日期函数:selectccollegecode,drecruitmentstartdate,add_months(drecruitmentstartd