Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please write the code in C or C++ Consider the following schema: Veterinarians (vid: integer, eLevel: integer); Examine (vid: integer, did: integer, fee:

Can you please write the code in C or C++

image text in transcribed

Consider the following schema: Veterinarians (vid: integer, eLevel: integer); Examine (vid: integer, did: integer, fee: integer); Dogs (did: integer, age: integer); The eLevel is meant to be an experience rating level; it is in the range: [1,4]. Fee is in the approximate range: [75,300], age is in the range: [9, 14] Heap files corresponding to instances of the above relations are VFile (for Veterinarians), EFile (for Examine) and DFile (for Dogs), on each line of the heap file, the attributes are listed in the above corresponding schema order. These files are located in the CourseInfo folder of the Course Files for this class (see notes on page 2). You are to write a C/C++ program to find the answer to the following query: SELECT V.eLevel, COUNT(*), AVG (X. fee), AVG (D.age) FROM Dogs D, Exmaine x, Veterinarians V WHERE D.did=X. did AND X.vid=v.vid GROUP BY V. eLevel You are expected to implement an efficient join algorithm as part of your solution to this problem. However, you must assume that main memory is limited, and it is not possible to read all of the relations into main memory at once; in particular, your solution is expected to be able to handle the situation where at least one of the files is of unbounded (unknown) size. Your program is to use VFile, DFile and EFile as input to the program. Your score on this problem may be based in part on the performance of your implementation; that is, how quickly your program produces the correct results. You must implement your own join algorithm. It is NOT acceptable to use library routines / system calls / commands / etc. which provide a join capability. For your answer to this problem: Turn in a description of the join algorithm that you used; output that shows your answer to the query along with timing output that shows how long it took to execute on the VM (over); also, include a listing of your program. In addition, leave a copy of your program and executable in your CourseFile folder for this class. Include in your answer your starid and a description of how to run your program (a user manual). How to display the results: - For the COUNT value, show all digits of the result. - For the average values (AVG), compute the result as a floating point number and display at least 4 digits to the right of the decimal point (ddd.dddd). Note: a large part of the score for this problem is based on the number of correct answers that your program produces for the COUNT and AVG values. Consider the following schema: Veterinarians (vid: integer, eLevel: integer); Examine (vid: integer, did: integer, fee: integer); Dogs (did: integer, age: integer); The eLevel is meant to be an experience rating level; it is in the range: [1,4]. Fee is in the approximate range: [75,300], age is in the range: [9, 14] Heap files corresponding to instances of the above relations are VFile (for Veterinarians), EFile (for Examine) and DFile (for Dogs), on each line of the heap file, the attributes are listed in the above corresponding schema order. These files are located in the CourseInfo folder of the Course Files for this class (see notes on page 2). You are to write a C/C++ program to find the answer to the following query: SELECT V.eLevel, COUNT(*), AVG (X. fee), AVG (D.age) FROM Dogs D, Exmaine x, Veterinarians V WHERE D.did=X. did AND X.vid=v.vid GROUP BY V. eLevel You are expected to implement an efficient join algorithm as part of your solution to this problem. However, you must assume that main memory is limited, and it is not possible to read all of the relations into main memory at once; in particular, your solution is expected to be able to handle the situation where at least one of the files is of unbounded (unknown) size. Your program is to use VFile, DFile and EFile as input to the program. Your score on this problem may be based in part on the performance of your implementation; that is, how quickly your program produces the correct results. You must implement your own join algorithm. It is NOT acceptable to use library routines / system calls / commands / etc. which provide a join capability. For your answer to this problem: Turn in a description of the join algorithm that you used; output that shows your answer to the query along with timing output that shows how long it took to execute on the VM (over); also, include a listing of your program. In addition, leave a copy of your program and executable in your CourseFile folder for this class. Include in your answer your starid and a description of how to run your program (a user manual). How to display the results: - For the COUNT value, show all digits of the result. - For the average values (AVG), compute the result as a floating point number and display at least 4 digits to the right of the decimal point (ddd.dddd). Note: a large part of the score for this problem is based on the number of correct answers that your program produces for the COUNT and AVG values

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago