Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

ASSIGNMENT 6 – These problems are to be done by hand. Hand-write and scan in, or type your solutions where indicated on these pages. In this assignment you will use the following tables...

1 answer below »
ASSIGNMENT 6 – These problems are to be done by hand.
Hand-write and scan in, or type your solutions where indicated on these pages.
In this assignment you will use the following tables (relations):
    
    
SYMBOLS: σ (Selection) Π (Projection) ⋈ (Join) ^ (And)
NOTE THAT WHEN A PROBLEM OR EXAMPLE USES A RANGE VARIABLE BELOW, IT IS THE FIRST LETTER OF THE TABLE NAME.
PROBLEM 1:
Using the given tables & data, show, in table form, the results of the following alge
a query:
Π sid, gpa (SENIORS)
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 2:
Using the given tables & data, show, in table form, the results of the following alge
a query:
Π creditsSoFar (SENIORS)
ANSWER:
QUESTION: Do you have three rows or four? Why?
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 3:
Show, in table form, the results of the following alge
a query:
JUNIORS U SENIORS
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 4:
Show, in table form, the results of the following alge
a query:
σgpa > 3.5 (SENIORS)
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 5:
Problem 5A:
Show, in table form, the results of the following alge
a query:
SENIORS ⋈s.sid = t.sid TAKEN
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
Problem 5B:
Show, in table form, the results of the following alge
a query:
JUNIORS ⋈s.sid = t.sid TAKEN
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 6:
Show, in table form, the results of the following alge
a query:
    
    SENIORS ⋈s.sid = t.sid TAKEN
UNION
JUNIORS ⋈s.sid = t.sid TAKEN
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 7:
Write the alge
a query for this statement: Find the names of students who have taken the course with the id number of 502.
ANSWER:
Show the results in tabular form:
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
1 point extra credit: Can you think of a different way to do this? (To get the extra credit, it must be substantially different, not a simple moving around of the text.)
ALTERNATIVE ANSWER:
PROBLEM 8:
Write the alge
a query for this statement: Find the names of students who have taken CMPSC 465.
ANSWER:
Show the results in tabular form:
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 9:
Write the alge
a query for this statement: Find the courses (e.g., ENGL 202C) taken by anyone with a GPA greater than or equal to 3.9
ANSWER:
Show the results in tabular form (two columns):
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
PROBLEM 10:
Write the alge
a query for this statement: Find the name of all students who have taken at least one class.
ANSWER:
Show the results in tabular form:
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
ONE POINT EXTRA CREDIT - PROBLEM 11:
Write the alge
a query for this statement: Find the name of students who have taken at least one of ENG 202C, PHYS 211.
ANSWER:
Show the results in tabular form:
ANSWER:
What is the SQL statement you would use to do this?
ANSWER:
Answered 1 days After Oct 30, 2022

Solution

Mohd Abas answered on Oct 31 2022
56 Votes
PROBLEM 1:
Π sid, gpa (SENIORS)
ANSWER:
SQL statement to the results of the above projection statement is as under:

SELECT DISTINCT sid,gpa FROM SENIORS;
PROBLEM 2:
Π creditsSoFar (SENIORS)
ANSWER:
QUESTION: Do you have three rows or four? Why?
ANSWER:
Above projection operation fetched only three rows, because the projection operation excludes the duplicate data.
SQL statement for the above answer is as:
SELECT DISTINCT                                         creditsSoFar                                     FROM                                                        SENIORS;                    

PROBLEM 3:
JUNIORS U SENIORS
ANSWER:
The SQL statement to fetch out the above results is as under:
SELECT * FROM JUNIORS, SENIORS;
PROBLEM 4:
σgpa > 3.5 (SENIORS)
ANSWER:
SQL statement to fetch the list of students whose gpa > 3.5 is given below:
SELECT * FROM SENIORS WHERE gpa > 3.5;
PROBLEM 5:
Part A:
SENIORS ⋈s.sid = t.sid TAKEN
ANSWER:
     QUERY STRUCTURE
Results of the above...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here