Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following relational schema: Department(deptid, dname, location) Student(snum, sname, deptid, age) Faculty (fid, fname, deptid) Class(cname, deptid meets_at, room, faculty) Enrolled(snum. cname, score, grade)

image text in transcribed

image text in transcribed

Consider the following relational schema: Department(deptid, dname, location) Student(snum, sname, deptid, age) Faculty (fid, fname, deptid) Class(cname, deptid meets_at, room, faculty) Enrolled(snum. cname, score, grade) Assume that: All students and faculty members must major/work in one depart- ment; Faculty teach courses only in the department they belong to; The names of the courses are unique for each department Scores are numbers in [0,100]; Faculty in Table Class is a subset of fid in Table Faculty Write each of the following queries using Datalog. If you believe any one of the following is not expressible in Datalog, informally explain why it can- not be expressed 7. (10 pts) Find the faculty who have instructed at least one course in the CS department but have never instructed any course in the Math- ematics department. 8. (10 pts) Find the names of courses each student gets the lowest score in, i.e., if a student takes 2 courses A and B and scores 50 and 60, respectively, then A is the name of the course in which that stu- dent (can be different for different students depending on their score) has scored the lowest 9. (15 pts) What are the possible outcomes if a Datalog rule is unsafe? Please illustrate two different scenarios for this case by designing un- safe rules for the relational schema mentioned above, and explain the answers to these rules Consider the following relational schema: Department(deptid, dname, location) Student(snum, sname, deptid, age) Faculty (fid, fname, deptid) Class(cname, deptid meets_at, room, faculty) Enrolled(snum. cname, score, grade) Assume that: All students and faculty members must major/work in one depart- ment; Faculty teach courses only in the department they belong to; The names of the courses are unique for each department Scores are numbers in [0,100]; Faculty in Table Class is a subset of fid in Table Faculty Write each of the following queries using Datalog. If you believe any one of the following is not expressible in Datalog, informally explain why it can- not be expressed 7. (10 pts) Find the faculty who have instructed at least one course in the CS department but have never instructed any course in the Math- ematics department. 8. (10 pts) Find the names of courses each student gets the lowest score in, i.e., if a student takes 2 courses A and B and scores 50 and 60, respectively, then A is the name of the course in which that stu- dent (can be different for different students depending on their score) has scored the lowest 9. (15 pts) What are the possible outcomes if a Datalog rule is unsafe? Please illustrate two different scenarios for this case by designing un- safe rules for the relational schema mentioned above, and explain the answers to these rules

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

a. What is the purpose of the team?

Answered: 1 week ago

Question

b. What are its goals and objectives?

Answered: 1 week ago