Giter Site home page Giter Site logo

lab-mysql-regex's Introduction

logo_ironhack_blue 7

Lab | mySQL Regex

In this lab, you will be using the Sakila database of movie rentals. You have been using this database for a couple labs already, but if you need to get the data again, refer to the official installation link.

The database is structured as follows: DB schema



Submission

Create a .sql file where you'll gather your responses. Either copy them as you test them on workbench or code them and File > Save script.

Instructions

  1. How many distinct (different) actors' last names are there?

  2. In how many different languages where the films originally produced? (Use the column language_id from the film table)

  3. How many movies were released with "PG-13" rating?

  4. Get 10 the longest movies from 2006.

  5. How many days has been the company operating (check DATEDIFF() function)?

  6. Show rental info with additional columns month and weekday. Get 20.

  7. Add an additional column day_type with values 'weekend' and 'workday' depending on the rental day of the week.

  8. How many rentals were in the last month of activity?

  9. Get film ratings.

  10. Get release years.

  11. Get all films with ARMAGEDDON in the title.

  12. Get all films with APOLLO in the title

  13. Get all films which title ends with APOLLO.

  14. Get all films with word DATE in the title.

  15. Get 10 films with the longest title.

  16. Get 10 the longest films.

  17. How many films include Behind the Scenes content?

  18. List films ordered by release year and title in alphabetical order.

  19. Drop column picture from staff.

  20. A new person is hired to help Jon. Her name is TAMMY SANDERS, and she is a customer. Update the database accordingly.

  21. Add rental for movie "Academy Dinosaur" by Charlotte Hunter from Mike Hillyer at Store 1. You can use current date for the rental_date column in the rental table. Hint: Check the columns in the table rental and see what information you would need to add there. You can query those pieces of information. For eg., you would notice that you need customer_id information as well. To get that you can use the following query:

    select customer_id from sakila.customer
    where first_name = 'CHARLOTTE' and last_name = 'HUNTER';

    Use similar method to get inventory_id, film_id, and staff_id.

  22. Delete non-active users, but first, create a backup table deleted_users to store customer_id, email, and the date for the users that would be deleted. Follow these steps:

    • Check if there are any non-active users
    • Create a table backup table as suggested
    • Insert the non active users in the table backup table
    • Delete the non active users from the table customer

lab-mysql-regex's People

Contributors

pauperl avatar gasparms9 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.