-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: master
Are you sure you want to change the base?
'solution' #8
Conversation
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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%' |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use *
No description provided.