This assignment uses the CH08SURGERY table. If you did not create the table whil
ID: 3716515 • Letter: T
Question
This assignment uses the CH08SURGERY table. If you did not create the table while working in this chapter, create it now by using SQL*Plus Worksheet to run the create_table.sql file in the DataChapter08 directory on your student disk. Analyze the CH08SURGERY table.
Write one or more queries on data dictionary view(s) to answer these questions:
? How many rows are in the table?
? What is the average length of a row in the table?
? How many columns have no values in any rows? ? What is the average length of the DOCTOR_NAME column?
? How many distinct values are there in the PATIENT_FIRST_NAME and PATIENT_ LAST_NAME columns?
? What is the segment name and extent ID of the table’s segment and extent? Save your SQL commands in a file named ho0803.sql in the SolutionsChapter08 directory on your student disk.
Explanation / Answer
Solution:
How many rows are in the table?
SELECT COUNT(*) FROM CH08SURGERY
What is the average length of a row in the table?
How many columns have no values in any rows?
SELECT * FROM CH08SURGERY WHERE IS NULL
What is the average length of the DOCTOR_NAME column?
This can be figured out from the data dictionary
How many distinct values are there in the PATIENT_FIRST_NAME and PATIENT_ LAST_NAME columns?
SELECT COUNT(DISTINCT PATIENT_FIRST_NAME ) AS FirstCount, COUNT(DISTINCT PATIENT_ LAST_NAME) AS SecondCount
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)