Question

In: Computer Science

Consider the following relations: Please answer in the form of symbol. Thank You Student (ssn, name,...

Consider the following relations: Please answer in the form of symbol. Thank You

Student (ssn, name, address, major)

Course(code, title)

Registered(ssn,code)

  1. List the titles of all courses
  2. List the information of the students majoring in ‘CS’
  3. List the codes of courses for which at least one student is registered (registered courses
  4. List the titles of registered courses
  5. List the codes of courses for which no student is registered

Solutions

Expert Solution

As per the question we have to write SQL queries for the tables.

Student (ssn, name, address, major)

Course(code, title)

Registered(ssn,code)

As per above tables we have to implement queries as given below:

1. List the titles of all courses.

2. List the information of the students majoring in ‘CS’.

3. List the codes of courses for which at least one student is registered (registered courses).

4. List the titles of registered courses.

5. List the codes of courses for which no student are registered.

Let’s see queries one by one.

1. List the titles of all courses.

Solution:-

Select title from course;

2. List the information of the students majoring in ‘CS’.

    Solution:-

          Select ssn, name, address from Student

          Where major=’CS’;

3. List the codes of courses for which at least one student is registered (registered courses).

Solution:-

Select code from course

INNER JOIN Student S on Course.name = S.code

Where S.code>1;

4. List the titles of registered courses.

Solution:-

Select C.title from Course C,

INNER JOIN Registered_Course R on c.title = R.Registered_Course

Group by c.title;

5. List the codes of courses for which no student are registered.

Solution:-

Select code from Course

INNER JOIN Student S on Registered.code = S.code

Where code = null;


Related Solutions

Please answer in paragraph form and this question is in term of Marketing. Thank you!! Why...
Please answer in paragraph form and this question is in term of Marketing. Thank you!! Why would a celebrity want to be careful about endorsing brands that might be controversial? In other words what happens when a celebrity you like endorses a product that you do not like?
2. Consider the following relations: Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum) Patient(SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN)...
2. Consider the following relations: Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum) Patient(SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN) Medicine(TradeName, UnitPrice, GenericFlag) Prescription(Prescription Id, Date, Doctor_SSN, Patient_SSN) Prescription_Medicine(Prescription Id, TradeName, NumOfUnits) Note: The Medicine relation has attributes, trade name, unit price, and whether or not the medicine is generic (True or False). a. Determine the functional dependencies that exist in each table given above.
COURSE : IT Enterprise systems Consider the Relations below STUDENT Student# Std-Name Address 1 Smith Jeddah...
COURSE : IT Enterprise systems Consider the Relations below STUDENT Student# Std-Name Address 1 Smith Jeddah 2 Bob Buraidah 3 Alice Dammam COURSE Student# Course Code Course-Name 1 IT241 Operating System 2 IT210 Computer Network 2 IT445 Decision Support System Write a query using the Right Outer Join to retrieve the record from the two relations. Also, construct the table displaying the output of your query. note: NEED A UNIQUE ANSWER AND NO HANDWRITING PLEASE.. THANK YOU
******Please don't use handwriting and i need unique answer ... Thank you Q3: Consider the following...
******Please don't use handwriting and i need unique answer ... Thank you Q3: Consider the following relation: Student-Dept = (Student-ID, Course, SportActivity, Dept-Name, Building) Having following multivalued dependencies:             F ={ Student-ID ®® Course                    Student-ID ®® SportsActivity                      Dept-Name ®® Building } Explain in your own words why the Student-Dept relation is not in 4NF. Then, convert the Student-Dept relation in 4NF. Also, provide the justification for each step you perform during normalization (4NF). Note: The SportActivity here...
******Please don't use handwriting and i need unique answer ... Thank you Q3: Consider the following...
******Please don't use handwriting and i need unique answer ... Thank you Q3: Consider the following relation: Student-Dept = (Student-ID, Course, SportActivity, Dept-Name, Building) Having following multivalued dependencies:             F ={ Student-ID ®® Course                    Student-ID ®® SportsActivity                      Dept-Name ®® Building } Explain in your own words why the Student-Dept relation is not in 4NF. Then, convert the Student-Dept relation in 4NF. Also, provide the justification for each step you perform during normalization (4NF). Note: The SportActivity here...
Hi all, Can someone please answer this CASH FLOW question. Thank you. Consider the following information:...
Hi all, Can someone please answer this CASH FLOW question. Thank you. Consider the following information: Cash Flows ($) Project C0 C1 C2 C3 C4 A –5,500 1,500 1,500 3,500 0 B –500 0 400 2,500 3,500 C 3,800 500 3,100 1,000 500 a. What is the payback period on each of the above projects? (Round your answers to 2 decimal places.) Project Payback Period A year(s) B year(s) C year(s) b. Given that you wish to use the payback...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Introduction to Biostatistics Please answer...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Introduction to Biostatistics Please answer the following questions: I need new and unique answers, please. (Use your own words, don't copy and paste) i need more than 500 words pleasssse Q1. Discuss the tools to measure central tendency. Q2. a) Discuss parametric and nonparametric test used for hypothesis testing. b) In a cross sectional study on coronary heart disease (CHD), the smoking and CHD status is summarized below. Use...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a square root is achieved using the sqrt() function, but a warning will be issued when the argument is negative. Consider the following code which is designed to test whether a given value is positive before checking whether the square root of the value is less than 5. testValue <-7 (testValue > 0) & (sqrt(testValue) < 5) ## [1] TRUE testValue <--7 (testValue > 0)...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a square root is achieved using the sqrt() function, but a warning will be issued when the argument is negative. Consider the following code which is designed to test whether a given value is positive before checking whether the square root of the value is less than 5. testValue <-7 (testValue > 0) & (sqrt(testValue) < 5) ## [1] TRUE testValue <--7 (testValue > 0)...
PLEASE ANSWER IN EXCEL FORMAT, WITH FORMULA USED. Thank you!! 8.Consider the following three stocks: ▪Stock...
PLEASE ANSWER IN EXCEL FORMAT, WITH FORMULA USED. Thank you!! 8.Consider the following three stocks: ▪Stock A is expected to provide a dividend of $11.10 a share forever. ▪Stock B is expected to pay a dividend of $6.10 next year. Thereafter, dividend growth is expected to be 5.00% a year forever. ▪Stock C is expected to pay a dividend of $4.90 next year. Thereafter, dividend growth is expected to be 21.00% a year for five years (i.e., years 2 through...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT