Giter Club home page Giter Club logo

taskmanager's Introduction

Go to WEB version

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 task
    ORDER BY status ASC;
  2. get the count of all tasks in each project, order by tasks count descending

    SELECT DISTINCT project_id, count(id) AS projecsCount
    FROM task
    GROUP BY project_id
    ORDER BY projecsCount DESC;
  3. get the count of all tasks in each project, order by projects names

    SELECT project.name, count(task.id)
    FROM project
    LEFT JOIN task ON project_id = project.id
    GROUP BY project_id
    ORDER BY project.name;
  4. get the tasks for all projects having the name beginning with “N” letter

    SELECT *
    FROM task
    WHERE name LIKE 'N%';
  5. 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 project.name, count(task.id)
    FROM project LEFT JOIN task ON task.project_id = project.id
    WHERE project.name LIKE '%a%'
    GROUP BY project_id;
  6. get the list of tasks with duplicate names. Order alphabetically

    SELECT name
    FROM task
    GROUP BY name
    HAVING count(name)>1
    ORDER BY name ASC;
  7. get the list of tasks having several exact matches of both name and status, from the project ‘Garage’. Order by matches count

    SELECT name, count(name) AS mathces
    FROM task
    WHERE task.project_id = (SELECT project.id FROM project WHERE project.name LIKE 'Garage')
    GROUP BY task.name, task.status
    HAVING count(*) > 1
    ORDER BY mathces ASC;
  8. get the list of project names having more than 10 tasks in status ‘completed’. Order by project_id

    SELECT project.id, project.name, count(project_id) AS countoftasks
    FROM project
    LEFT JOIN task ON task.project_id = project.id
      WHERE task.status = 'completed'
    GROUP BY project_id
    HAVING countoftasks > 10

taskmanager's People

Contributors

andrii-novikov avatar

Watchers

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