Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework feedback Database Week 1 #2

Open
shekhardaima opened this issue Aug 17, 2019 · 0 comments
Open

Homework feedback Database Week 1 #2

shekhardaima opened this issue Aug 17, 2019 · 0 comments

Comments

@shekhardaima
Copy link

shekhardaima commented Aug 17, 2019

Most of your queries are correct, here are a few tips and corrections:

-- Find all the task that are marked as done
We can use Alias for table names to avoid typing long names repeatedly.
select t.title, s.name from task t inner join status s on t.status_id = s.id where s.name ='Done';

select task.title, status.name from task inner join status on task.status_id = status.id where status.name ='Done';

-- Get the names of all statuses, sorted by the status with most tasks first
We also need to sort in Descending order.
select status.name, count(task.status_id) from task inner join status on task.status_id = status.id group by status.name order by count(task.status_id) desc;
-- Get the names of all statuses, sorted by the status with most tasks first
select status.name, count(task.status_id) from task inner join status on task.status_id = status.id group by status.name;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant