
Data types and functions - Assignments
1. Calculate the average number of films of actors
Complete the following query to determine the average number of films in which actors play.
- Use the
SELECTandFROMstatements. - Use the
AVG()function.
| avg |
|---|
| 1.0429994756161510 |
2. Find the maximum number of films in which an actor plays
Complete the following query to find the maximum number of films in which an actor plays.
- Use the
SELECTandFROMstatements. - Use the
MAX()function.
| max |
|---|
| 9 |
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
SELECTandFROMstatements. - Use the
LEFT()function.
| left |
|---|
| L |
| A |
| W |
| ... |
4. (Extra) Compose the name of an actor
Write a query to obtain the initial, a period, and the last name of the actors in one column.
An example of how a name should look:
L. Abernathy
- Use the
SELECTandFROMstatements. - Use the
CONCAT()function. - Use the
LEFT()function.
| concat |
|---|
| L. Abernathy |
| A. Adamson |
| W. Addy |
| ... |
5. (Extra) Compose the name of an actor, with the number of films
Write a query to obtain the initial, a period, the last name, and in parentheses the number of films, of the actors in one column.
An example of how this should look:
L. Abernathy (1)
| concat |
|---|
| L. Abernathy (1) |
| A. Adamson (1) |
| W. Addy (1) |
| ... |