Aditya Mishra
Aditya Mishra

Reputation: 1

I can't use PERCENTILE_DISC and PERCENTILE_CONT in MySQL, getting some error

I am using PERCENTILE_DISC() window function in mysql , but getting an error , don't know why, but this same query working fine on my friend's mysql workbench

error -->

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(ORDER BY Price) OVER() FROM drug_clean' at line 1

SELECT PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY Price) OVER()
FROM drug_clean

I am expecting to get 50 percentile value or median for price column, but getting an error

Upvotes: 0

Views: 1119

Answers (1)

Vinit
Vinit

Reputation: 1

The problem is Percentile_Disc doesn't work even as a window function in MySQL server, so you have to download MariaDB server (https://mariadb.org/download/?t=mariadb&p=mariadb&r=11.2.0&os=windows&cpu=x86_64&pkg=msi&m=aliyun) from this link you can download.

After installing MariaDB

Open Workbench and

Right click on your default database

Go to edit connection

THERE YOU WILL SEE 3 TABS (parameter, SSL, Advance)

GO to Advance

Go to Others Box

There write these following 2 things:

  1. serverVersion=11.2MariaDB (Write the version of MariaDB server installed in your pc)

  2. useSSL=0

PS: If you have installed MySQL server already then while installing MariaDB you will be asked to type a new port name (which is by default 3306 for local computer). I don't know if you could write any number like 3307 or 3308, but what I did was that I deleted MySQL server first and then installed MariaDB server.

Upvotes: 0

Related Questions