GithubHelp home page GithubHelp logo

todo-garage's Introduction

The test task for Ruby on Rails courses from RubiGarage

In the first part of the service is implemented project management

Technical stack project:

Client-side

  • Specification: HTML5 & CSS3
  • Script languages: JavaScript
  • JS-libraries: jQuery, Underscore
  • MV*-frameworks: Backbone.js
  • CSS-preprocessors: SASS
  • CSS-framework: Bootstrap 3

Ruby stack

  • Languages: Ruby 2.1
  • MVC-framework: Rails
  • Template engine: erb
  • ORM: Active Record

Database

  • Development: SQLite3
  • Production: PostgreSQL

Deployment and teamwork

  • Cloud platform: Heroku
  • Revision control: git

The second part - check SQL knowledge

SQL task Given tables:

  • tasks (id, name, status, project_id)
  • projects (id, name)

Write the queries for:

  1. get all statuses, not repeating, alphabetically ordered

SELECT DISTINCT status FROM tasks ORDER BY status ASC

  1. get the count of all tasks in each project, order by tasks count descending

SELECT projects.name, COUNT(tasks.Id) AS tasks_count FROM projects LEFT OUTER JOIN tasks ON (projects.Id=tasks.project_id) GROUP BY projects.name ORDER BY tasks_count DESC

  1. get the count of all tasks in each project, order by projects names

SELECT projects.name, COUNT(tasks.Id) AS tasks_count FROM projects LEFT OUTER JOIN tasks ON (projects.Id=tasks.project_id) GROUP BY projects.name ORDER BY projects.name ASC

  1. get the tasks for all projects having the name beginning with “N” letter

SELECT tasks.name FROM projects LEFT OUTER JOIN tasks ON (projects.Id=tasks.project_id) WHERE SUBSTRING(projects.name, 1, 1) = 'N'

  1. get the list of all projects containing the ‘a’ letter in the middle of the name, and show the tasks count near each project. Mention that there can exist projects without tasks and tasks with project_id=NULL

SELECT projects.name, COUNT(tasks.Id) AS tasks_count FROM projects LEFT OUTER JOIN tasks ON (projects.Id=tasks.project_id) GROUP BY projects.name HAVING SUBSTRING(projects.name, ROUND((LEN(projects.name)+1)/2, 0), 1) = 'a'

  1. get the list of tasks with duplicate names. Order alphabetically

SELECT name FROM tasks GROUP BY name HAVING COUNT(name)>1

  1. get the list of tasks having several exact matches of both name and status, from the project ‘Garage’. Order by matches count

SELECT tasks.name FROM projects LEFT JOIN tasks ON (projects.Id=tasks.project_id) WHERE projects.name='Garage' GROUP BY tasks.name, tasks.status HAVING COUNT(CONCAT(tasks.name, tasks.status))>1 ORDER BY COUNT(CONCAT(tasks.name, tasks.status))

  1. get the list of project names having more than 10 tasks in status ‘completed’. Order by project_id

SELECT projects.name, tasks.status, tasks.project_id FROM projects LEFT JOIN tasks ON (projects.Id=tasks.project_id) GROUP BY projects.name, tasks.status, tasks.project_id HAVING tasks.status='completed' AND COUNT(tasks.Id)>10 ORDER BY project_id


###Grateful organization RubyGarage for the opportunity to participate in the competition

Development by Nik Bailo

todo-garage's People

Watchers

James Cloos avatar Nik Bailo 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.