Written Problems - Spatial Database Group

advertisement
CSci 5708: Architecture and Implementation of Database Systems
Homework 4
Due date: 4/21
Maximum Points: 100 All questions carry equal points.
Question 1
Consider the following GRANT statements being executed by the Database Administrator
(DBA) and the group of users Harry, Ron, Hermione, Fred and George.
(1) DBA grants insert, update, delete, and select privileges on Employee table to Harry with
GRANT option.
(2) Harry grants select, delete and insert privilege on Employee table to Ron with GRANT
option.
(3) Harry grants delete and update privilege on Employee table to Hermione with GRANT
option.
(4) Hermione grants update and delete privileges to Ron with GRANT option.
(5) Ron grants delete, update and insert privilege on Employee table to Fred with GRANT
option.
(6) Fred grants update privilege on Employee table to George.
(7) Fred grants delete privilege on Employee table to Hermione with GRANT option.
(8) Hermione grants update privilege to George.
(9) Harry grants update privilege to George.
(a) Draw the authorization grant graph of this scenario.
(b) Which REVOKE statements are needed to remove delete privilege from Ron ? Write down
the statements. (The permissions held by Harry must not be affected.)
(c) Revoking which of the above GRANT statements would not impact the privileges held by
each of the five users? (Hint: More than one grant statements may be omitted.)
(d) The DBA executes revoke statement (with cascade) on the update privileges of Harry. Write
down the privileges held by Harry, Ron, Hermione, Fred and George after this revoke
statement.
Question 2
Consider the multi-level relation Employee table given below (Table 2). Here TS, S, C and U
represent the four security levels with TS>S>C>U. Show the state of the table after each of the
following updates are attempted. Assume that the Mandatory Access Control is implemented
using the Bell-LaPadula Model.
Name
Peter U
Mark S
Scott C
Table 1: Multi-level relation Employee
Salary
Job Performance
50000 S
Good U
30000 S
Fair S
400000 TS
Excellent S
TC
S
S
TS
(a) A user with classification level C attempts to update the job performance of Peter to
‘Excellent’.
(b) A user with classification level S attempts to update the salary of Mark to 50000.
(c) A user with classification level C attempts to update the Job Performance of Scott to
‘Good’.
(d) Would a user with classification level S be able to compute the aggregate salary of the
employees? Justify your answer.
Question 3
Apply the Apriori algorithm for mining association rule to the dataset in Table 2. (I1, I2, I3, I4, I5,
I6 represent the distinct ‘Item’ types). List all the frequent itemsets with support >= 0.2.
Table 2: Transactions
Transaction_id
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Items_purchased
I1, I2, I5
I2, I4, I6
I2, I3
I1, I2, I4
I1, I3
I2, I3, I6
I1, I3
I1, I2, I3, I5
I1, I2, I3, I6
I1, I4, I5
I2, I6
I3, I4, I5
I1, I2, I3, I4, I5
I4, I5, I6
I1, I3, I6
I1, I2, I4, I5
Question 4
Apply the K-means algorithm for k = ‘2’ on the following set of two-dimensional records. Use
records with RID 2 and 6 as the initial centroids. List the dimensions of the final centroids and
the partition (i.e. list of points in each cluster).
Table 3: 2- dimensional records
RID
1
2
3
4
5
6
7
8
9
Dimension 1
1
2
3
3
4
5
6
7
8
Dimension 2
3
2
1
2
3
2
1
1
2
Question 5
Answer questions based on the following SQL Schema:
Table 4: SQL Schema
SQL2 schema
SQL3 schema
create table employee (
eid integer,
name char(30),
age integer,
address char(30) );
create table project (
pid integer,
title char(30),
years integer,
director_eid integer);
create table work_on(
eid integer,
pid integer);
note: 1. primary keys are
underlined.
2. foreign keys are
work_on.pid, work_on.eid and
Project.director_eid.
create type employee_type as (
name char(30),
age
integer,
address char(30) );
create table employee of employee_type (
ref is employeeid system generated,
primary key employeeid );
create type project_type as (
title
char(30),
years integer,
director
ref(employee_type) scope employee
);
create table project of project_type (
ref is projectid system generated;
primary key projectid );
create table workon (
employee ref(employee_type) scope employee,
project
ref(project_type) scope project );
a) Match each Sql2 queries with corresponding Sql3 queries.
SQL2 Queries
(1) select e.name
from employee e, work_on w
where e.eid=w.eid;
(2) select p.title
from project p, workon w
where p.pid=w.pid
and p.years>3;
(3) select e.name
from employee e, works_on w,
project p
where e.eid = w.eid and p.pid =
w.pid
and p.director_Eid = e.eid
(a)
(b)
(c)
(d)
(e)
(f)
SQL3 Queries
select e.name
from employee e, workon w
where
w.employee.employeeid=e.employeeid;
select p.title
from project p, workon w
where p.projectid=w.project.projectid
and p.years>3;
select w.employee->name
from workon w;
select w.project->title
from workon w
where w.project->years>3;
select w.employee->name
from works_on w
where w.employee->employeeid =
w.project->director->employeeid
select e.name
from workon w, employee e, project p
where w.project.projectID=p.projectID
and
e.employeeID=w.employee.employeeID;
Answer:
SQL2 Queries
(1)
(2)
(3)
SQL3 Queries
Download