Ga naar inhoud

Header

Data types and functions - Assignments

1. Calculate the average number of movies of actors

Complete the following query to determine the average number of movies in which actors appear.

  • Use the SELECT and FROM statements.
  • Use the AVG() function.
SELECT
  ...(film_count)
FROM
  actors;




2. Find the maximum number of movies an actor appears in

Complete the following query to find the maximum number of movies in which an actor appears.

  • Use the SELECT and FROM statements.
  • Use the MAX() function.
SELECT
  ...
...
  ...;




3. Obtain the initial of the first name of actors

Complete the following query to obtain the initial (first letter) of each actor's first name.

  • Use the SELECT and FROM statements.
  • Use the LEFT() function.
...
  ...(first_name, ...)
...
  actors;




4. (Extra) Compose an actor's name

Write a query to obtain in one column the initial, a period, and the last name of the actors.

An example of how a name should look:

L. Abernathy

  • Use the SELECT and FROM statements.
  • Use the CONCAT() function.
  • Use the LEFT() function.
...




5. (Extra) Compose an actor's name, with the number of movies

Write a query to obtain in one column the initial, a period, the last name, and in parentheses the number of movies, of the actors.

An example of how this should look:

L. Abernathy (1)

...