sql >> Database >  >> RDS >> Oracle

Top n procent top n%

Je kunt dit proberen:

WITH     got_analytics     AS
(
     SELECT     ssn, gpa
     ,     ROW_NUMBER () OVER (ORDER BY  gpa  DESC)     AS r_num
     ,     COUNT (*)     OVER ()                                AS n_rows 
     FROM  student_gpa   
)
SELECT       ssn, gpa
FROM       got_analytics 
WHERE       r_num     <= ROUND (n_rows * 12/*insert here your n%*/ / 100)
ORDER BY  gpa     DESC           


  1. EM12c Database Wachttijd waarschuwingen

  2. Databasestatistieken SQL Server-update

  3. Getallen opmaken met komma's in PostgreSQL

  4. Wereldback-updag:4 interessante feiten over gegevensverlies om te weten