Question

Write a MySQL View to get the number of films acted by each actor. Your output...

Write a MySQL View to get the number of films acted by each actor. Your output should return the following..

First_Name, Last_Name, Total_films_acted

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

here i assume a table for example.

CREATE TABLE table1 (First_Name varchar(100),Last_Name varchar(100),films varchar(100));
INSERT INTO table1 (First_Name,Last_Name,films) VALUES ('kavya','tulabandula','abc');
INSERT INTO table1 (First_Name,Last_Name,films) VALUES ('kavya','1','abc');
INSERT INTO table1 (First_Name,Last_Name,films) VALUES ('kavya','tulabandula','a');
INSERT INTO table1 (First_Name,Last_Name,films) VALUES ('ganesh','tulabandula','abc');
INSERT INTO table1 (First_Name,Last_Name,films) VALUES ('aruna','tulabandula','abc');
INSERT INTO table1 (First_Name,Last_Name,films) VALUES ('kavya','tulabandula','xyz');

CREATE VIEW EXAMPLE AS SELECT First_Name,Last_Name,count(films) as Total_films_acted FROM table1 group by First_Name,Last_Name;
select * from EXAMPLE;

Add a comment
Know the answer?
Add Answer to:
Write a MySQL View to get the number of films acted by each actor. Your output...
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
  • Consider the table actor which already exists in our database, with 200 rows. Upon executing SHOW...

    Consider the table actor which already exists in our database, with 200 rows. Upon executing SHOW CREATE TABLE `actor`, we get the following: CREATE TABLE `actor` ( `actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `first_name` varchar(10) NOT NULL, `last_name` varchar(10) NOT NULL, `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`actor_id`), KEY `idx_actor_last_name` (`last_name`) ) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8 You will need this table for any questions below which refer to an `actor` table. 1. Using the actor...

  • I want write a MySQL query to get the number of customers who have made at...

    I want write a MySQL query to get the number of customers who have made at least one purchase in each group (gender, education), I know how to do with two seperate query. but is that possible to get one query with the column like: gender | counts | education | counts The first 5 rows of each table looks like this: customers customer_id | first_name | last_name | state | birthdate | education | gender | date_account_opened 50 |...

  • 13 Write a query to display each department’s name, location, number of employees, and the average...

    13 Write a query to display each department’s name, location, number of employees, and the average salary for all employees in that department. Label the columns Department , Location, Number of Workers, and Average Salary, respectively. Round the average salary to two decimal places . Tables (Filtered) + COUNTRIES DEPARTMENTS 0 DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID 1 LOCATION_ID 0 EMPLOYEES - EMPLOYEE_ID 1 FIRST_NAME LAST_NAME EMAIL IPHONE_NUMBER HIRE_DATE JOB_ID SALARY 0 COMMISSION_PCT " MANAGER_ID " DEPARTMENT_ID + JOB_GRADES - JOB_HISTORY + JOBS...

  • Write code for mySQL 1) create a new one database ; to create your table 2)...

    Write code for mySQL 1) create a new one database ; to create your table 2) Every table should have a primary key 3) Table relationship has to be based on foreign key and shown within your physical table 4) Insert 5 data records in every table 9) Create a database view that return result set of all record and all columns within all 6 table

  • Write a program that does the following in Python Code: Stores the following three lists: last_name...

    Write a program that does the following in Python Code: Stores the following three lists: last_name = ["Smith", "Jones", "Williams", "Bailey", "Rogers", "Pyle", "Rossington"] first_name =["Lisa", "Bill", "Jay", "Sally", "Walter","Jake","Gary"] phone_number =["240-233-1921", "301-394-2745", "571-321-8934", "703-238-3432", "703-947-9987", "301-945-3593", "240-671-3221"] Has a function named combine_lists() that takes in last_names, first_names and phone_numbers as lists and returns a dictionary called phone_book that uses last_name as the key and a list consisting of first_name and phone_number. Has a main function that iterates through the...

  • Java Your boss has just put you in charge of updating the company's client contact list....

    Java Your boss has just put you in charge of updating the company's client contact list. This file contains records in the following format: id,first_name,last_name,email 1,Norry,Killby,nkillby0@photobucket.com Your job is to reformat each record as follows: last_name, first_name, email Killby, Norry, <nkillby0@photobucket.com> Starter Code: package contactlistupdater; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Paths; import java.util.Formatter; import java.util.Scanner; import sun.reflect.generics.reflectiveObjects.NotImplementedException; public class ContactListUpdater { private static final String INPUT_FILENAME = "contacts.txt"; private static final String OUTPUT_FILENAME = "updated-contacts.txt"; /** * Transforms a String...

  • Help! i can't get the correct output for this question: Write a program that will read...

    Help! i can't get the correct output for this question: Write a program that will read in an integer from the user and test to see whether or not it is prime. You are to determine if each integer read is prime or not, and output the result to the screen as shown below. If a number is prime, your output should read: 101 = 1 x 101 101: PRIME Number For a number that turns out not to be...

  • WRITE A PROGRAM IN C++ , YOUR PROGRAM SHOULD PROMT THE USER FOR THE NUMBER OF...

    WRITE A PROGRAM IN C++ , YOUR PROGRAM SHOULD PROMT THE USER FOR THE NUMBER OF SUITOR AND YOU SHOULD DISPLAY THE OUTPUT SIMILAR TO THE IMAGE.. SHOULD HAVE PRINTED OUT THE BEFORE AND AFTER ERASE..... using class function in c++ to return the erase value.

  • Using the OrderItemProducts View, create a new View named ProductSummary. This View should return some summary...

    Using the OrderItemProducts View, create a new View named ProductSummary. This View should return some summary information about each product. We want the name of the product, the number of times the product has been ordered and the total sales for the product. Use appropriate column names. Write a SELECT statement that uses the view that you created in exercise 3 to get total sales for the five best selling products.

  • What is the output of the following program? Show each step  to get to the output #include...

    What is the output of the following program? Show each step  to get to the output #include <stdio.h> int f(int* a, int* b); int main() {        int a = 6, b = 7, c = 8;        b = f(&c, &a);        printf("a = %d, b = %d, c = %d\n", a, b, c);           return 0; } int f(int* a, int* b) {        *a = *a + *b;        *b = *a - *b;        printf("a = %d,...

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