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

'solution' #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

'solution' #8

wants to merge 2 commits into from

Conversation

DmytroSiianytsia
Copy link

No description provided.

README.md Outdated
```

4. Create a query that would return a single row: the person with the ID of 5.

```postgresql
... here goes your SQL ...
SELECT id, first_name, last_name, year_birth, year_death FROM people WHERE id = 5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better will be SELECT * FROM people WHERE id = 5

README.md Outdated
```

5. Create a query that would return the four people with the following IDs: 1, 3, 7, 8.

```postgresql
... here goes your SQL ...
SELECT id, first_name, last_name, year_birth, year_death FROM people WHERE id = 1 OR id =3 OR id = 7 OR id = 8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to use IN

README.md Outdated
```

6. Create a query that would return all the people except the person with the ID of 4 (`Winston Churchill`).

```postgresql
... here goes your SQL ...
SELECT id, first_name, last_name, year_birth, year_death FROM people WHERE id != 4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you need to select all columns use *

```

14. Create a query that would select the people whose first name starts with a letter that precedes `M` in the English alphabet:

```postgresql
... here goes your SQL ...
SELECT first_name, last_name FROM people WHERE first_name < 'M%'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to select all people (all columns)

README.md Outdated
```

15. Create a query that would return all the people sorted by their last name alphabetically:

```postgresql
... here goes your SQL ...
SELECT first_name, last_name FROM people ORDER BY last_name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to select all people (all columns)

README.md Outdated
```

17. Create a query that would return the people sorted by their year of birth in the descending order, and then (if two or more people share the same year of birth) by their last name alphabetically:

```postgresql
... here goes your SQL ...
SELECT id, first_name, last_name, year_birth, year_death FROM people ORDER BY year_birth DESC, last_name
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use *

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

Successfully merging this pull request may close these issues.

2 participants