pgexercises | PostgreSQL Exercises web site code | SQL Database library
kandi X-RAY | pgexercises Summary
kandi X-RAY | pgexercises Summary
pgexercises
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- tokenizer for text stream
- Combines regexp into a list of possible regex patterns .
- Convert normal to normal .
- Creates a source decorator for the given options .
- Tokenize attributes
- Get a list of HTML templates .
- Show the autocomplete hints
- An inline style rule .
- Handles mouseup event .
- Parse JS token .
pgexercises Key Features
pgexercises Examples and Code Snippets
Community Discussions
Trending Discussions on pgexercises
QUESTION
I was solving this PostreSQL excercise (in the link you can find the statement and the database diagram) and I came out with this solution:
...ANSWER
Answered 2022-Jan-02 at 03:29You ORDER BY mem.firstname
, while the solution uses member
. What is important here is that, member
not only contains that firstname
, but actually that exact thing the error message hints at:
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
Interpretation: When selecting a distinct value, all expressions in your GROUP BY
must be distinct.
So, the reason for the error, is because you tell it to order by only the first name, and that attribute must be what you said to be DISTINCT
in the SELECT
clause. But it isn't, it is partially there, but there's also: ' ' || mems.surname
QUESTION
For the exercise
https://pgexercises.com/questions/aggregates/fachours1a.html
with the schema diagrams:
I'm trying to: "Produce a list of facilities with more than 1000 slots booked. Produce an output table consisting of facility id and slots, sorted by facility id."
The solution using the having
clause is quite simple
ANSWER
Answered 2021-Feb-06 at 23:02You can use a subquery:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pgexercises
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page