0

I am getting an error in my PostGresQL code.

org.postgresql.util.PSQLException: ERROR: syntax error at end of input Position: 250 FROM tutorial.crunchbase_companies

This usually works so I am not sure what my error means.

4
  • Sample data and desired results would help. What does "percent total of distinct count" mean? Commented Mar 3, 2021 at 15:51
  • As far as I can see, the error message is raised because you are missing a closing paranthesis at the end. Commented Mar 3, 2021 at 15:56
  • Your last column when you try to divide by after the 100 you have an open paren ( but no closing one anywhere. Commented Mar 3, 2021 at 15:56
  • Check your syntax, commas, closing brackets etc Commented Feb 3, 2023 at 9:00

1 Answer 1

1

I suspect that you want the total companies, the companies with non-NULL values for a column and the ratio.

If so, this has nothing to do with distinct:

SELECT COUNT(*),
       COUNT(funding_total_usd) as num_with_funding,
       AVG( (funding_total_usd IS NOT NULL)::int ) as ratio_with_funding
FROM tutorial.crunchbase_companies;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.