user2784327
user2784327

Reputation: 421

ORA-00933: SQL command not properly ended ORACLE

select  
  (
    (select Count(country_isoname) from games.country where country_olympic_code is null)
    /
    (select Count(*) from games.country)
  ) * 100 as 'Percentage'
from 
  games.country;

I am currently trying to get the percentage but getting an error, syntax looks correct i think? PLease help!

Upvotes: 0

Views: 5641

Answers (2)

Abhijith Nagarajan
Abhijith Nagarajan

Reputation: 4030

Try using this

select (t1.specific_count/t2.all_count)*100 from 
(select count(country_isoname) as specific_count from country    
where country_olympic_code is null) t1, 
(select count(*) as all_count from country) t2; 

Upvotes: 1

user330315
user330315

Reputation:

'Percentage' is a string literal. Object (column) names have be enclosed with double quotes.

So you need to use "Percentage" not 'Percentage'

Upvotes: 4

Related Questions