Advertisement
Svlash

Untitled

Mar 6th, 2023
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.78 KB | Software | 0 0
  1. 2.Find all films whose title contains the word "love".
  2.  
  3. SELECT
  4.     *
  5. FROM
  6.     film
  7. WHERE
  8.     title LIKE '%love%';
  9.  
  10. 3. Find all actors whose first name is "John".
  11.  
  12. SELECT
  13.     *
  14. FROM
  15.     sakila.actor
  16. WHERE
  17.     first_name = 'John';
  18.  
  19.  
  20. 4. Find all cities whose name starts with "S".
  21. SELECT
  22.     *
  23. FROM
  24.     sakila.city
  25. WHERE
  26.     city LIKE 'S%';
  27.  
  28. 5. Find all countries whose name contains the word "land".
  29. SELECT
  30.     *
  31. FROM
  32.     sakila.country
  33. WHERE
  34.     country LIKE '%land%';
  35.  
  36.  
  37. 6. Find all stores whose address contains the word "Main".
  38.  
  39.  
  40.  
  41. 7. Find all payments that are greater than $10.
  42. SELECT
  43.     *
  44. FROM
  45.     sakila.payment
  46. WHERE
  47.     amount > 10;
  48.  
  49.  
  50. 8. Find all customers whose last name is "Smith" or "Johnson".
  51. SELECT
  52.     *
  53. FROM
  54.     customer
  55. WHERE
  56.     last_name = 'Smith' OR 'Johnson';
  57.  
  58.  
  59. 9. Find all employees whose first name is not "John".
  60.  
  61. SELECT
  62.     *
  63. FROM
  64.     staff
  65. WHERE
  66.     first_name != 'John';
  67.  
  68.  
  69. 10. Find all films whose rental rate is between $3 and $4.
  70. SELECT
  71.     *
  72. FROM
  73.     sakila.film
  74. WHERE
  75.     rental_rate BETWEEN 2.99 AND 3.99;
  76.  
  77. 11. Find all actors whose last name starts with "B" and is followed by exactly 5 symbols.
  78. SELECT
  79.     *
  80. FROM
  81.     sakila.actor
  82. WHERE
  83.     last_name LIKE '%B_____';
  84.  
  85.  
  86. 12. Find all films that are rated "PG-13".
  87.  
  88. SELECT
  89.     *
  90. FROM
  91.     sakila.film
  92. WHERE
  93.     rating = 'Pg-13';
  94.  
  95.  
  96. 13. Find all actors whose last name ends with "son".
  97.  
  98. SELECT
  99.     *
  100. FROM
  101.     sakila.actor
  102. WHERE
  103.     last_name LIKE '%son';
  104.  
  105.  
  106. 14. Find all films that have a length of more than 1.5 hours.
  107.  
  108. SELECT
  109.     *
  110. FROM
  111.     sakila.film
  112. WHERE
  113.     length > 1.5;
  114.  
  115.  
  116. 15. Find all customers whose first name starts with "A".
  117.  
  118. SELECT
  119.     *
  120. FROM
  121.     sakila.customer
  122. WHERE
  123.     first_name LIKE 'A%';
  124.  
  125.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement