- Specification: HTML5 & CSS3
- Script languages: JavaScript
- JS-libraries: jQuery, Underscore
- MV*-frameworks: Backbone.js
- CSS-preprocessors: SASS
- CSS-framework: Bootstrap 3
- Languages: Ruby 2.1
- MVC-framework: Rails
- Template engine: erb
- ORM: Active Record
- Development: SQLite3
- Production: PostgreSQL
- Cloud platform: Heroku
- Revision control: git
- tasks (id, name, status, project_id)
- projects (id, name)
- get all statuses, not repeating, alphabetically ordered
SELECT DISTINCT status FROM tasks ORDER BY status ASC
- 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
- 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
- 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'
- 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'
- get the list of tasks with duplicate names. Order alphabetically
SELECT name FROM tasks GROUP BY name HAVING COUNT(name)>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))
- 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