GithubHelp home page GithubHelp logo

chinook_music's Introduction

2.2.3. Questions

Maintenant que ta BDD est prête, tu vas répondre aux questions ci-dessous : a) Niveau facile

Quel est le nombre total d'objets Album contenus dans la base (sans regarder les id bien sûr) ? ALbum.count Qui est l'auteur de la chanson "White Room" ? a = Track.find_by(title:"White Room") a.artist Quelle chanson dure exactement 188133 milliseconds ? Track.find_by(duration:188133).title Quel groupe a sorti l'album "Use Your Illusion II" ? Album.find_by(title:"Use Your Illusion II").artist b) Niveau Moyen

Combien y a t'il d'albums dont le titre contient "Great" ? (indice) Album.where(title:"Great").count Supprime tous les albums dont le nom contient "music". Album.where(title:"music").destroy_all Combien y a t'il d'albums écrits par AC/DC ? Album.where(artist: "AC/DC").count Combien de chanson durent exactement 158589 millisecondes ? Track.where(duration: 158589).count c) Niveau Difficile

Pour ces questions, tu vas devoir effectuer des boucles dans la console Rails. C'est peu commun mais c'est faisable, tout comme dans IRB.

puts en console tous les titres de AC/DC. Track.where(artist:"AC/DC").each do |x| puts x.title end puts en console tous les titres de l'album "Let There Be Rock". Track.where(album: "Let There Be Rock").each do |x| puts x.title end Calcule le prix total de cet album ainsi que sa durée totale.

Track.where(album: "Let There Be Rock").sum(:price) Track.where(album: "Let There Be Rock").sum(:duration)

Calcule le coût de l'intégralité de la discographie de "Deep Purple". Track.where(artist: "Deep Purple").sum(:price)

Modifie (via une boucle) tous les titres de "Eric Clapton" afin qu'ils soient affichés avec "Britney Spears" en artist. Track.where(artist: "Eric Clapton").each do |x| x.update(artist: "Britney Spears") end

chinook_music's People

Contributors

cheikh-kebe avatar

Watchers

 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.