ConradWen commented on issue #2005:
URL: https://github.com/apache/doris-website/issues/2005#issuecomment-2645786955

   Path:/zh-CN/docs/sql-manual/sql-functions/window-functions/percent-rank
   The test data can be used as the following examples:
   ”
   create table test_percent_rank
   (
       productLine varchar(128),
       orderYear int,
       orderValue double,
       percentile_rank double
   )
   engine=olap
   distributed by hash(orderYear) buckets 4
   properties(
       "replication_num"="1"
   );
   
   INSERT INTO test_percent_rank (productLine, orderYear, orderValue, 
percentile_rank) 
   VALUES
   ('Motorcycles', 2003, 2440.50, 0.00),
   ('Trains', 2003, 2770.95, 0.17),
   ('Trucks and Buses', 2003, 3284.28, 0.33),
   ('Vintage Cars', 2003, 4080.00, 0.50),
   ('Planes', 2003, 4825.44, 0.67),
   ('Ships', 2003, 5072.71, 0.83),
   ('Classic Cars', 2003, 5571.80, 1.00),
   ('Motorcycles', 2004, 2598.77, 0.00),
   ('Vintage Cars', 2004, 2819.28, 0.17),
   ('Planes', 2004, 2857.35, 0.33),
   ('Ships', 2004, 4301.15, 0.50),
   ('Trucks and Buses', 2004, 4615.64, 0.67),
   ('Trains', 2004, 4646.88, 0.83),
   ('Classic Cars', 2004, 8124.98, 1.00),
   ('Ships', 2005, 1603.20, 0.00),
   ('Motorcycles', 2005, 3774.00, 0.17),
   ('Planes', 2005, 4018.00, 0.50),
   ('Vintage Cars', 2005, 5346.50, 0.67),
   ('Classic Cars', 2005, 5971.35, 0.83),
   ('Trucks and Buses', 2005, 6295.03, 1.00);
   
   select * from test_percent_rank;
   
   select
       productLine,
       orderYear,
       orderValue,
       round(percent_rank() over (partition by orderYear
           order by orderValue),2) as percentile_rank
   from test_percent_rank
   order by orderYear;
   “


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to