Question

please any on can help me with this question the question is: Using the view s18h7z,...

please any on can help me with this question

the question is:

Using the view s18h7z, write a function S18h7_4 that counts the number of films in a category within a specific range of number of actors. It takes three parameters:

1. Category: the name of a category

2. min_actors: the minimum number of actors a film must have in order to be counted.

3. min_actors: the maximum number of actors a film must not exceed in order to be counted.

I wrote the function and it is gives me the corrct results except when I wrote select S18h7_4('sports', 0,10);
the result i got is 68 and it supposes to be 69

create view s18h7z as
select s7.film_id, f.title, c.name,
count(distinct fa.actor_id ) as num_actors, s7.sum_renters
from f s7 right join film f on ( f.film_id = s7.film_id) right join
film_actor fa on (f.film_id=fa.film_id) right join film_category fc
on (fa.film_id=fc.film_id)
left join category c on ( fc.category_id=c.category_id)
Group by f.film_id, f.title;

this is the function

delimiter //
CREATE FUNCTION S18h7_44
(vname varchar(10), min_actors INT, max_actors INT )RETURNS INT
BEGIN
DECLARE result int default 0;
select count(film_id) INTO result
From s18h7l
where vname= name
and num_actors >= min_actors
and num_actors <= max_actors;
RETURN result;
end //
delimiter ;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

-----According to my aspect, you are using S18h7_4('sports', 0,10); means 0 actor, but i hope it should be 1 actor minimum, so try with S18h7_4('sports', 1,10); I hope you get the desired result.

Add a comment
Know the answer?
Add Answer to:
please any on can help me with this question the question is: Using the view s18h7z,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using SQL and the following info Question 3: Find the people who do not have Viper...

    Using SQL and the following info Question 3: Find the people who do not have Viper Certification but are still assigned to Viper class ship Find the fname, lname, and ship_instance_id for all people who do not have Viper certification but are assigned to at least one instance of a Viper class ship (this includes all variants of Viper class ships). Return a row for every ship/person combination. Order your results by fname in ascending order. Use the BSG database...

  • Using SQL and the following info Question 3: Find the people who do not have Viper...

    Using SQL and the following info Question 3: Find the people who do not have Viper Certification but are still assigned to Viper class ship Find the fname, lname, and ship_instance_id for all people who do not have Viper certification but are assigned to at least one instance of a Viper class ship (this includes all variants of Viper class ships). Return a row for every ship/person combination. Order your results by fname in ascending order. Use the BSG database...

  • Form A Mid-Term Exam In ajoin, when using the ON keyword, column names need to be...

    Form A Mid-Term Exam In ajoin, when using the ON keyword, column names need to be qualified only A in inner joins B. in outer joins c when the code is confusing D. when the same column names exist in both tables 7. Referring to the following code example and the data model the total number of rows returned by this query must equal SELECT vendor name, Invoice number FROM invoices LEFT JOIN vendors ON Invoices. vendor id = vendors.vendor...

  • Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...

    Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make the following modifications: For the vendors table: Comment out the table-level primary key Change the VendorIDcolumn to be a column-level primary key Add a VendorEmail column to the bottom of the table definition (define the data type for the column as variable character and set it to not exceed 45 characters) After the lineItems table, add code to create a table...

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • Task1: Construct and run the code for a natural inner join on the two tables                        ...

    Task1: Construct and run the code for a natural inner join on the two tables                         AccountState and AccountUserState Task 2: Construct and run the code for a natural inner join of                         AccountState, AccountUserState, ClientProperty Task 3: Construct and run the code for Right outer join on ClientProperty and                                     AccountUserState Task 4: Construct and run the code to sum the account totals for each branch. Construct your own database for this and enter the data. AccountNr, BranchNr, ClientNr...

  • Can you fix this program and run an output for me. I'm using C++ #include using...

    Can you fix this program and run an output for me. I'm using C++ #include using namespace std; //function to calculate number of unique digit in a number and retun it int countUniqueDigit(int input) {    int uniqueDigitCount = 0;    int storeDigit = 0;    int digit = 0;    while (input > 0) {        digit = 1 << (input % 10);        if (!(storeDigit & digit)) {            storeDigit |= digit;       ...

  • Question 10 Not complete Not graded Generalize the function you wrote previously so you can pass ...

    = Question 10 Not complete Not graded Generalize the function you wrote previously so you can pass in the name of a function as a parameter For example def tabulate_execution_cost(rows, funct_name): Flag question temp, count funct_name (data) To reproduce the previous table, you would call this function using tabulate_execution_cost (10, max_duplicates_in_1ist) For example Test Result tabulate_execution_cost (2, max_duplicates_in_list) NI COUNT| LOGN /N NLOGN /N* *2 13.0 6.5 13 13.0 26 26.0 13.0 tabulate_execution_cost (2, find_difference) COUNT | /LOGN N NLOGN...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • hi , can someone please help me with this question, thank you so much! A sodium...

    hi , can someone please help me with this question, thank you so much! A sodium vapour discharge lamp acted as the light source in the photos A pure sodium vapour discharge essentially produxes light at two closely spaced wavelengths in the yellow region of the visible spectrum at wavelengths of 589.6 and 589.0 For your work you should presume that only the light of one wavelength, 589.3 amis Theoretical Problems 1) Figure 3 is a schematic diagram showing the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT