资源描述:
《oraclea数据库操作》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、第四章ORACLEA数据库操作一、表空间1、创建CREATETABLESPACEMYSPDATAFILE'F:appAdministratoradminmydata01.dbf'SIZE50MAUTOEXTENDONNEXT10MMAXSIZE200m2、修改,添加数据文件mydata02.dbfALTERTABLESPACEMYSPADDDATAFILE'F:appAdministratoradminmydata02.dbf'SIZE100MREUSEAUTOEXTENDONNEXT10MMAXSIZEUNLIMI
2、TED二、创建表1、学生表createtablestudent(snochar(15)primarykey,snamechar(8)notnull,ssexchar(2),sageintdefault18,sdeptvarchar(20),constraintck_s1check(sagebetween15and35),constraintck_s2check(ssex='男'orssex='女'))tablespace"MYSP"2、课程表createtablecourse(cnochar(8)primarykey,cnamech
3、ar(30)notnullunique,ccreditnumber(2))tablespace"MYSP"3、成绩表createtablescore(snochar(15),cnochar(8),gradeint,primarykey(sno,cno),constraintfk_sc1foreignkey(sno)referencesstudent(sno),constraintfk_sc2foreignkey(cno)referencescourse(cno))tablespace"MYSP"三、录入数据1、学生表insertin
4、tostudentselect'0803010126','高天','男',20,'计算机'fromdualunionselect'0601020212','张新','女',21,'自动化'fromdualunionselect'0802020230','黎明','男',18,'材料'fromdualunionselect'0803020101','张铁','男',19,'采矿'fromdualunionselect'0702010205','刘芳','女',22,'自动化'fromdualunionselect'0603010114
5、','李振刚','男',23,'采矿'fromdualunionselect'0803020109','杨云','女',17,'材料'fromdualunionselect'0801010215','张扬','男',18,'材料'fromdualunionselect'0703020216','张书贺','男',21,'计算机'fromdualunionselect'0601010127','张庚源','男',23,'自动化'fromdualunionselect'0602010223','余杰','女',22,'自动化'fromd
6、ualunionselect'0701010132','刘一','女',19,'采矿'fromdualunionselect'0802020133','安然','女',20,'计算机'fromdualunionselect'0802010206','于多','男',19,'材料'fromdualunionselect'0703010111','王艳','女',21,'采矿'fromdualunionselect'0803020107','刘明浩','男',18,'计算机'fromdual2、课程表insertintocoursese
7、lect'A001','计算机导论',2fromdualunionselect'A002','C语言',3fromdualunionselect'A003','电子技术',4fromdualunionselect'A004','数据库',3fromdualunionselect'A005','工程力学',2fromdualunionselect'B001','接口原理',3fromdualunionselect'B002','无线技术',4fromdualunionselect'C001','采矿学',2fromdualunions
8、elect'C002','焊接技术',3fromdual3、成绩表insertintoscoreselect'0601020212','B001',89fromdualunionselect'0803010126','A002',45