




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
精品文档就在这里-------------各类专业好文档,值得你下载,教育,管理,论文,制度,方案手册,应有尽有-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------精品文档---------------------------------------------------------------------数据库设计与管理实验告学号:110506224姓名:张留春专业:信息管理与信息系统指导老师:刘俊实验1:Oracle的安装及其管理工具的使用实验2:创建数据库和表createtableEmployees(EmployeeIDchar(6)notnull,Namevarchar2(20)notnull,Birthdaydatenotnull,Sexnumber(1)notnull,Addressvarchar2(30)null,Zipchar(6)null,PhoneNumberchar(12)nullEmailAddressvarchar2(30)null,DepartmentIDchar(3)notnull,ConstraintEmployees_EmployeeID_fkPRIMARYKEY(EmployeeID));create
table
Departments
(
DepartmentID
char(3)
not
null,
DepartmentName
varchar2(20)
not
null,
Note
varchar2(20)null,
Constraint
Departments_DepartmentID_pk
PRIMARY
KEY(DepartmentID)
);createtableSalary(EmployeeIDchar(6)notnull,InComeNumber(8,2)notnull,OutComeNumber(8,2)notnull,Constraint
Salary_EmployeeID_pk
PRIMARY
KEY(EmployeeID));AltertableEmployeesAdd(constraintEmployees_DepartmentID_fkFOREIGNKEY(DepartmentID)referencesDepartments(DepartmentID));实验3(1)Employees表(2)Department表(3)Salary表(4)删除表Employees的第2、8行和Salary的第2、11行。注意进行删除操作时,作为两表主键的EmployeeID的值,以保持数据完整性。(5)删除表Departments的第2行,同时也要删除表Employees的第2行。(6)将表Employees中编号为020018的记录的部门号改为4。实验4:SQL编程select*fromemployees;2.selectaddress,phonenumberfromemployees;3.selectaddress,phonenumberfromemployeeswhereemployeeid='000001';4.selectaddressas地址,phonenumberas电话fromemployeeswheresex=0;5.selectemployeeid,(income-outcome)as实际收入fromsalary;6.selectdepartmentidfromemployeeswherenamelike'王%';7.selectemployeeidfromsalarywhereincomebetween2000and3000;8.select*fromemployeeswheredepartmentid=(selectdepartmentidfromdepartmentswheredepartmentname='财务处');9.selectnamefromemployeeswheredepartmentidin(selectdepartmentidfromdepartmentswheredepartmentname='财务处')andbirthday>all(selectbirthdayfromemployeeswheredepartmentidin(selectdepartmentidfromdepartmentswheredepartmentname='研发部'));10.selectnamefromemployeeswhereemployeeidin(selectemployeeidfromsalarywhereincome>all(selectincomefromsalarywhereemployeeidin(selectemployeeidfromdepartmentswheredepartmentname='财务处')));11.selectemployees.*,salary.*fromemployees,salarywhereemployees.employeeid=salary.employeeid;12.selectname,income,outcomefromemployees,salary,departmentswhereemployees.employeeid=salary.employeeidandemployees.departmentid=departments.departmentidanddepartmentname='财务处'andincome>2000;13.selectavg(income)as财务处平均工资fromsalarywhereemployeeidin(selectemployeeidfromemployeeswheredepartmentid=(selectdepartmentidfromdepartmentswheredepartmentname='财务处'));14.selectavg(income-outcome)as求财务部雇员的平均实际收入fromsalarywhereemployeeidin(selectemployeeidfromemployeeswheredepartmentid=(selectdepartmentidfromdepartmentswheredepartmentname='财务处'));15.selectcount(employeeid)fromemployeeswheredepartmentid=(selectdepartmentidfromdepartmentswheredepartmentname='财务处');16.selectcount(employeeid)fromemployeesgroupbydepartmentid;17.selectemployees.*,salary.*fromemployees,salarywhereemployees.employeeid=salary.employeeidorderbyincome;实验5:视图、存储过程(1)根据表employees建Vemployees视图createorreplaceviewVemployeesASselect*fromEmployees;(2))根据表departments建Vdepartments视图createorreplaceviewVdepartmentsASselect*fromDepartments;(3)根据表salary建Vsalary视图createorreplaceviewVsalaryASselect*fromSalary;(4)添加职员记录的存储过程CREATEORREPLACEPROCEDUREEmployeeAdd(employeeidinchar(6),nameinvarchar2(20),birthdayindatesexinnumber,addressinvarchar2(30),zipinchar(6),phonenumberinchar(12),emailaddressinvarchar2(30),departmentIDinchar(3))ASBEGININSERTINTOEmployeesVALUES(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,departmentID)ENDEmployeeAdd;(5)修改职员记录的存储过程CREATEORREPLACEPROCEDUREEmployeeUpdate(empidinchar(6),employeeidinchar(6),nameinvarchar2(20),birthdayindate,Sexinnumber,addressinvarchar2(30),zipinchar(6),phonenumberinchar(12),Emailaddressinvarchar2(30),departmentIDinchar(3))ASBEGINUPDATEEmployeesSETEmploeeid=employeeid,Name=name,Birthday=birthday,Sex=sex,Address=address,Zip=zip,Phonenumber=phonenumber,Email
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 强弱安装合同范本
- 2025至2030年中国玻璃墙座数据监测研究报告
- 2025至2030年中国物业管理信息系统数据监测研究报告
- 白水泥行业的产品设计国际化趋势
- 科技企业如何应对复杂的知识产权环境
- 科技引领未来移动支付在商业地产的应用研究
- 科技助力下的绿色餐饮创新实践案例分享
- 现代保安公司经营模式创新与教育领域融合研究
- 电竞产业未来创新发展方向研究报告
- 2025至2030年中国泥炭粉末数据监测研究报告
- 电解质溶液的图像分析(原卷版)-2025年高考化学一轮复习讲义(新教材新高考)
- 2025年中考历史一轮复习知识清单:隋唐时期
- 【生物】蒸腾作用- 2024-2025学年七年级上册生物(北师大版2024)
- 摩根大通金融科技支出
- 《井巷掘进作业》课件
- 银行保安服务 投标方案(技术方案)
- 《TCPIP协议基础》课件
- 2019年大学学术规范测试版题库500题(含标准答案)
- 养老院院长岗位职责(岗位说明书)
- 农村砍树赔偿合同模板
- 2024年贵州省公务员录用考试《行测》真题及答案解析
评论
0/150
提交评论