Research Paper University of West Florida – COP 4710 SQL_4 GRADED

Cartesian Product of all three tables: grade_report * student * section Display the COUNT of section-ids from the Section table, and then the COUNT of DISTINCT section-ids from the Grade_report table. What does this information tell you? Hint: section_id is the primary key of the Section table. The Cartesian is highest number count for each table multiplied with other table. For section row count would be 32 and Grade_report would be 209. Get the statement to work as a COUNT of a join of the three tables, Student, Grade_report, 105 and Section. Use table aliases in the join condition (remember to use /* join conditions */). Note that a join of n tables requires (n-1) join conditions, so here you have to have two join conditionsone to join the Student and Grade_report tables, and one to join the Grade_report and Section tables. Note the number of rows that you get (expect no more rows than is in the Grade_report table.) Why? Modify the query and put the accounting (ACCT) condition in the WHERE clause. Note the number of rows in the resultit should be a good bit less than in (a). COUNT(*) Again, modify the query and add the grade constraints. The number of rows should decrease again. Note that if you have WHERE x and y or z, parentheses are optional, but then the criteria will be interpreted according to precedence rules. How many students have names like SMITH or Smith? How many have names that contain the letter sequence SMITH? How many student names end in LD? Would SELECT * FROM Student WHERE sname LIKE SMITH% find someone whose name was: (i) LA SMITH (ii) SMITH-JONES (iii) SMITH JR. (iv) SMITH, JR no rows selected Answer: No. Would you call UPPER or LOWER an aggregate function? Why or why not? Yes because the queries would produce the same result. Pad all the student names in the Student table with … on the right. List the junior level COSC courses (like COSC3xxx) and the name of the course. Use the Course table. Using the COUNT feature, determine whether there are duplicate names or student numbers in the Student table. Assume that all math courses start with MATH. How many math courses are there in the Section table? From the COUNT of courses, does it appear that there are any math courses in the Section table that are not in the Course table? Again, using COUNTs, are there any math courses in the Course table that are not in the Section table? Does it appear that there are any courses at all that are in the Grade_report, Section, or Course tables that are not in the others? (We will study how to ask these questions in SQL in a later chapter). Note that a query like the following would not work: SELECT on_id FROM Grade_report g, Section t WHERE on_id < on_id; Explain why WHERE .. < .. will not work to produce the desired output. 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: DESCRIBE the table with DESC all_tables; Display the number of rows in all_tables. Use SELECT COUNT(*) FROM all_tables; Observe that 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 widewide in that there are often many attributes and many of those attributes are not necessarily interesting. SQL SELECT COUNT(*) FROM ALL_TABLES; Display the owner and table_name from all_tables where owner = your userid. Display the first two rows (use WHERE rownum < 3) of the all_tables table. MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS LOGGING BAC NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LOCK SAMPLE_SIZE LAST_ANALYZED PARTITION IOT_TYPE TEM SEC NESTED BUFFER_POOL FLASH_CACHE CELL_FLASH_CACHE ROW_MOVEMENT GLOBAL_ST USER_STAT COMPRESS_FOR DROPPED READ_ONLY SEGMENT_C RESULT_CACHE For Room, Course, Prereq, Department_to_major, list the attributes, number of rows, number of distinct rows, and number of rows without s. 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): all the tables in the Student-Course database Student, Grade_report, Section, Table Student Section Attribute stno sname major class section_id Rows without s 48 48 3 etc. Rows Distinct Rows 48 48 47 8 etc. etc. Also, note that there is probably no one query that will give you this information. You will have to find 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 Find the count, sum, average, minimum, and maximum capacity of rooms in the database (hint: Use the Room table for this question). SQL SELECT COUNT(CAPACITY), SUM(CAPACITY), AVG(CAPACITY), MIN(CAPACITY), MAX(CAPACITY) 2 FROM ; COUNT(CAPACITY) SUM(CAPACITY) AVG(CAPACITY) MIN(CAPACITY) MAX(CAPACITY) --------------- ------------- ------------- ------------- ------------- Where there is a value for the capacity, assume the capacity to be 40, and find the average room size again. In Chapter 2, we introduced some date functions, namely ADD_MONTHS and MONTHS_ BETWEEN. Use the MONTHS_BETWEEN and other appropriate functions to write one query that returns the number of years between the oldest and youngest student in the Student table. Show Less [Show less]

Custom Paper Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.