
Filtering with WHERE - Assignments
1. Retrieve data of actors with a specific first name
Complete the following query to obtain data from the actors table, where the first name (column first_name) is equal to 'Jennifer'.
- Use the
WHEREstatement.
2. Retrieve data of actors with a specific beginning of the first name
Complete the following query to obtain data from the actors table, where the first name (column first_name) begins with 'John'.
- Use the
WHEREstatement. - Use the
LIKEstatement. - Use the
%sign.
3. Retrieve data of actors with the last name from a list
Complete the following query to obtain data from the actors table, where the last name (column last_name) appears in the list: 'Anderson', 'Douglas', 'Williams'.
- Use the
WHEREstatement. - Use the
IN()operator.
4. Retrieve data of actors with a specific number of films
Complete the following query to obtain data from the actors table, where the number of films (column film_count) is equal to 3.
- Use the
WHEREstatement.
5. Retrieve data of actors with the number of films greater than or equal to a value
Complete the following query to obtain data from the actors table, where the number of films (column film_count) is greater than or equal to 3.
- Use the
WHEREstatement. - Use the
>=operator.
6. Retrieve data of actors with the number of films in a range
Complete the following query to obtain data from the actors table, where the number of films (column film_count) is at least 2 and at most 4.
- Use the
WHEREstatement. - Use the
BETWEENandANDoperators.
7. Retrieve data of actors with a specific gender and a specific number of films
Complete the following query to obtain data from the actors table, where:
- The gender (column
gender) is female ('F'). - And the number of films (column
film_count) is at least2.
- Use the
WHEREstatement. - Use the
ANDoperator.
8. (Extra) Retrieve data of actors with requirements for the first name
Complete the following query to obtain data from the actors table, where:
- The first name (column
first_name) must begin with'John'. - The length of the first name must be less than or equal to
9characters.
- Use the
WHEREstatement. - Use the
LIKEoperator. - Use the
LENGTH()function.
9. (Extra) Retrieve data of actors with requirements for the first and last name (1)
Complete the following query to obtain data from the actors table, where:
- The first name (column
first_name) must begin with the letter'j'.- It should not matter if it is a lowercase or uppercase letter.
- The second letter of the last name (column
last_name) must be equal to the lettera.- It should not matter if it is a lowercase or uppercase letter.
- The length of the last name must be greater than or equal to
10characters.
- Use the
WHEREstatement. - Use the
LIKEoperator. - Use the
LENGTH()function.
10. (Extra) Retrieve data of actors with requirements for the first and last name (2)
Complete the following query to obtain data from the actors table, where:
- The first name (column
first_name) must begin with the letters'je'.- It should not matter if it is a lowercase or uppercase letter.
- The last name (column
last_name) must not appear in the list'douglas','morrison'.- It should not matter if it is a lowercase or uppercase letter.