上海网站搜索排名,怎么创建公众号赚钱,电子商务网站建设用什么软件,学电脑在哪里报名What’s more
山东大学 2020级数据库系统 实验一 山东大学 2020级数据库系统 实验二 山东大学 2020级数据库系统 实验三 山东大学 2020级数据库系统 实验四 山东大学 2020级数据库系统 实验五 山东大学 2020级数据库系统 实验六 山东大学 2020级数据库系统 实验七 山东大学 20…What’s more
山东大学 2020级数据库系统 实验一 山东大学 2020级数据库系统 实验二 山东大学 2020级数据库系统 实验三 山东大学 2020级数据库系统 实验四 山东大学 2020级数据库系统 实验五 山东大学 2020级数据库系统 实验六 山东大学 2020级数据库系统 实验七 山东大学 2020级数据库系统 实验八、九
写在前面
做数据库实验一定要静得下心来才能发现其中的错误然后进行改正。同时如果发现 SQL 语句总是报错“一定是你错了只是不知道错在哪里”
其次SQL 语句中较为复杂的点博主都进行了注释希望大家一定要看懂思路后自己写一遍而不是盲目的 CtrlCCtrlV切记切记
实验八 8-1 一、 实验内容 启动两个不同浏览器firefox登录主账号userID、360浏览器登录备用账号userbID测试提交和回退的作用,了解锁等待、授权知识。 二、 实验步骤 1 使用主用户userID登入数据库简称主窗口。 2 使用备用用户userbID登入数据库简称备用窗口。 3 关闭自动提交复选框。 4 主用户访问备用用户的表之前需要在备用账号中将相应的表的相应的权限授权给主用户这样主用户才可以查询操作备用用户的相应的表。 在主用户下可以执行select * from userbId.test8_00查询备用用户的表test8_00的数据如果没有授权则会提示表没有表找到。 如果备用用户执行grant select on test8_00 to userID即授权表test8_00的select权限给用户userID上面的查询语句就可以正确执行并查询到相应的结果。 5 常用的授权、命令: grant select on test8_00 to userID授权表test8_00的select权限给用户userID。 grant update on test8_00 to userID授权表test8_00的update权限给用户userID。 grant insert on test8_00 to userID授权表test8_00的insert权限给用户userID。 grant delete on test8_00 to userID授权表test8_00的delete权限给用户userID。 grant all on test8_00 to userID授权表test8_00的all权限给用户userID。 revoke select on test8_00 from userID收回表test8_00的insert权限从用户userID。 6 在备用用户下将pub.teacher复制到test8_00中然后将其所有权限给主用户。 7 按表中序号在相应窗口执行对应的命令主用户访问备用用户表需要授权。 表格详见《数据库系统实验大纲》 8 假设数据中有张老师通过上面的操作以后他在每次查询的时候的年龄是多少根据你的判断得出结果然后按步骤进行实验验证在主用户下创建一个表test8_10(test varchar(20),age numeric (3)),插入10行数据分表存放10个结果。 避坑指南 注意首先要关闭 “自动提交” 哦将结果建立成表 test8_10 后一定要先提交之后再交卷验证哦 思路 1. 按照实验步骤一步一步地进行实验即可
结果1 88
结果2 90
结果3 90
结果4 86
结果5 90
结果6 90
结果7 86
结果8 86
结果9 76
结果10 86实验九
9-1 一、实验内容 学会复制表结构、学会插入数据特别是学会如何避免重复插入也就是如何避免插入已经存在的数据。 二、实验题目1 1创建表test9_01表的结构同pub.student_11_1一样。 2为test9_01的sid创建唯一不重复索引。 3将pub用户下的Student中性别是“女”的数据添加到test9_01中。 4将pub用户下的Student_11_1中性别是“女”的数据添加到test9_01中,如果某个学号已经包含在test9_01中这个记录就不要再插入了即不要插入重复学号的数据。 5将pub用户下的Student_11_2中性别是“女”的数据添加到test9_01中,如果某个学号已经包含在test9_01中这个记录就不要再插入了即不要插入重复学号的数据。 6要求完成上述功能请采用1条create table、1条create index、3条insert共5条SQL方式完成。 思路 先建立表然后创建索引根据条件一个一个插入即可
create table test9_01 asselect *from pub.student_11_1where 10create unique index sid_index on test9_01(sid)insert into test9_01select *from pub.studentwhere sex 女insert into test9_01select *from pub.student_11_1where sex 女and sid not in(select sidfrom test9_01)insert into test9_01select *from pub.student_11_2where sex 女and sid not in(select sidfrom test9_01)9-2 三、实验题目2 7创建表test9_02表的结构同pub.student_11_1一样。 8为test9_02的sid创建唯一不重复索引。 9将pub用户下的Student中性别是“女”的且pub.student_course中存在不及格成绩的同学添加到test9_02中。 10将pub用户下的Student_11_1中性别是“女”的且pub.student_course中存在不及格成绩的同学数据添加到test9_02中,如果某个学号已经包含在test9_02中这个记录就不要再插入了即不要插入重复学号的数据。 11将pub用户下的Student_11_2中性别是“女”的且pub.student_course中存在不及格成绩的同学数据添加到test9_02中,如果某个学号已经包含在test9_02中这个记录就不要再插入了即不要插入重复学号的数据。 12要求完成上述功能请采用1条create table、1条create index、3条insert共5条SQL方式完成。 思路
create table test9_02 asselect *from pub.student_11_1where 10insert into test9_02select *from pub.studentwhere sex 女and sid in(select sidfrom pub.student_coursewhere score 60)insert into test9_02select *from pub.student_11_1where sex 女and sid in(select sidfrom pub.student_coursewhere score 60)and sid not in(select sidfrom test9_02)insert into test9_02select *from pub.student_11_2where sex 女and sid in(select sidfrom pub.student_coursewhere score 60)and sid not in(select sidfrom test9_02)再次强调一定是看懂思路之后自己实践哈~~ 有问题还请斧正