Question

In: Computer Science

4-5. List the junior level COSC courses (like COSC3xxx) and the name of the course. Use...

4-5. List the junior level COSC courses (like COSC3xxx) and the name of the course. Use the Course table.


4-6. Using the COUNT feature, determine whether there are duplicate names or student numbers in the Student table.


4-7. Assume all math courses start with MATH. How many math courses are there in the Section table? From the COUNT of courses, does it appear there are any math courses in the Section table not in the Course table? Again, using COUNTs, are there any math courses in the Course table not in the Section table? Does it appear there are any courses at all in the Grade_report, Section, or Course tables not in the others? (We will study how to ask these questions in SQL in a later chapter). A query like the following would not work:

SELECT g.section_id

FROM Grade_report g, Section t

WHERE g.section_id <> t.section_id;
Explain why WHERE .. <> .. will not work to produce the desired output.


4-8. Display dictionary views for the tables we have in the Student-Course database (refer to the diagram in Appendix 3 for all the table names). Use “All_tables” as the dictionary view. Do the query as follows:

a. DESCRIBE the table with DESC All_tables;

b. Display the number of rows in All_tables. Use SELECT COUNT(*) FROM All_tables; When you are exploring the dictionary, it is not a good idea to simply SELECT * FROM whatever, where whatever is some dictionary view. Dictionary views are often long and wide --wide because there are often many attributes and many of those attributes are not necessarily interesting.


c. Display the owner and table_name from All_tables where owner = ‘your userid’.

CREATE THE TABLE FOR only for Student, GradeReport, and Section QUESTION 4-9.

4-9. For all the tables in the Student-Course database --Student, Grade_report, Section, Room, Course, Prereq, Department_to_major, list the attributes, number of rows, number of distinct rows, and number of rows without nulls. As you gather the information, put the information in a tabular format, as shown below (Note, you may want to create this table in your word processor as you gather the information.)
Table Attribute Rows Distinct Rows Rows without Nulls Student stno
48
sname major
class Section section_id etc.
Also, there is probably no “one” query to give you this information. You will have to fi nd this information using separate queries, and then put the information together in a tabular format. Hint: You can use:
SELECT COUNT (*) FROM Student WHERE sname IS NULL

Solutions

Expert Solution

Q4-5. List the junior level COSC courses (like COSC3xxx) and the name of the course. Use the Course table.
Answer:-----
SELECT course_number, course_name
FROM Course
WHERE course_number LIKE 'COSC3%';


Q4-6. Using the COUNT feature, determine whether there are duplicate names or student numbers in the Student table.
Answer:-----
SELECT COUNT(sname) FROM Student;
SELECT COUNT(stno) FROM Student​​​​​​​;
SELECT COUNT(DISTINCT sname) FROM Student​​​​​​​;
SELECT COUNT(DISTINCT stno) FROM Student​​​​​​​;


​​​​​​​
​​​​​​​

Q4-7. Assume all math courses start with MATH. How many math courses are there in the Section table? From the COUNT of courses, does it appear there are any math courses in the Section table not in the Course table? Again, using COUNTs, are there any math courses in the Course table not in the Section table? Does it appear there are any courses at all in the Grade_report, Section, or Course tables not in the others? (We will study how to ask these questions in SQL in a later chapter). A query like the following would not work:

SELECT g.section_id

FROM Grade_report g, Section t

WHERE g.section_id <> t.section_id;
Explain why WHERE .. <> .. will not work to produce the desired output.
Answer:----
​​​​SELECT COUNT(course_number)
FROM Section
WHERE course_number LIKE 'MATH%';
< > is NOT an = condition.


Q4-8. Display dictionary views for the tables we have in the Student-Course database (refer to the diagram in Appendix 3 for all the table names). Use “All_tables” as the dictionary view. Do the query as follows:

a. DESCRIBE the table with DESC All_tables;
Answer:-------
DESC ALL_TABLES ;

b. Display the number of rows in All_tables. Use SELECT COUNT(*) FROM All_tables; When you are exploring the dictionary, it is not a good idea to simply SELECT * FROM whatever, where whatever is some dictionary view. Dictionary views are often long and wide --wide because there are often many attributes and many of those attributes are not necessarily interesting.
Answer:-------
SELECT COUNT(*) FROM ALL_TABLES;


c. Display the owner and table_name from All_tables where owner = ‘your userid’.
Answer:-------
SELECT owner, table_name
FROM ALL_TABLES
WHERE owner = 'ATSW';


Related Solutions

List 5 largest segments of the hospitality industry. For each of these, name and describe 4...
List 5 largest segments of the hospitality industry. For each of these, name and describe 4 to 5 positions. In terms of number of people employed list and describe 2 segment of the hospitality industry that are declining and 2 segment that are growing.
12. Political Party Affiliation and Class level Freshman Sophomore Junior Senior Total Democrat 1 4 5...
12. Political Party Affiliation and Class level Freshman Sophomore Junior Senior Total Democrat 1 4 5 3 13 Republican 4 8 4 2 18 Green 1 3 3 2 9 Libertarian 1 1 2 1 5 Peace/Freedom 2 3 3 2 10 Total 6 15 12 7 55 Perform a hypothesis test to determine whether there is an association between class levels and political party affiliation.
For Questions 4 and 5, use the list of reasons provided below: List of Reasons for...
For Questions 4 and 5, use the list of reasons provided below: List of Reasons for Intervention Risk Aversion and Risk Trading Monopoly Power or Market Power Negative Externality Positive Externality Public Good Asymmetric Information/Adverse Selection Moral Hazard or Hidden Action. Some insurance companies require individuals to take a blood test before qualifying for lower health insurance premiums. a.Identify the problem that insurance companies are trying to address. Choose from list above. (1 point) b. Briefly explain how the proposed...
Use a for loop to ask a user to enter the grades of 5 courses. The...
Use a for loop to ask a user to enter the grades of 5 courses. The user should enter character values, e.g., A. Calculate the GPA of the user Hint: Convert the character values entered to numerals, e.g., A to 4 c programming help me please
ACT Prep Course. ACT prep courses like to market that you can increase your ACT score...
ACT Prep Course. ACT prep courses like to market that you can increase your ACT score by taking their courses. Some statisticians were curious how effective these courses really were. They decided to investigate the truth of the claim by measuring the average score increase for a random sample of students selected to take an ACT prep course. These students took the ACT twice, once before and once after taking the course. The variable of interest was the increase in...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Ethics and Regulations in Heal...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Ethics and Regulations in Heal ***Please complete my answer to be 500 words .. I need new and unique answers, please. (Use your own words, don't copy and paste) Question: 1: In certain cases it's legally and ethically appropriate for health professionals to proceed with a treatment without consent or proceed with a treatment that is against the patient decision, give your opinion in detail and examples. Question: 2:...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Introduction to Anatomy and Physiology...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Introduction to Anatomy and Physiology BIOL102 yeeees .. For HUMAN CIRCULATORY SYSTEM please re-write my answer by (Use your own words, don't copy and paste) Q) Choose any system of the human body and prepare a response to the following questions in 1-2 pages: Introduction(Explain the system with the components) Body(Explain how the system relates to achieve homeostasis in human body) Conclusion( Choose any disease common in KSA and...
Explain why economists like to use performance in follow-on courses to measure professor quality as opposed...
Explain why economists like to use performance in follow-on courses to measure professor quality as opposed to performance in the student's current courses.
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 Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Introduction to Biostatistics PHC 121...
Please Use your keyboard (Don't use handwriting) Thank you.. Courses Name: Introduction to Biostatistics PHC 121 Please answer the following questions: ***Please i need more than 500 words .. I need new and unique answers, please. (Use your own words, don't copy and paste) 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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT