PostgresSQL/Server LENGTH and CHAR_LENGTH difference
SELECT CHAR_LENGTH(‘你’), LENGTH(‘你’); In MySQL, this returns 1 and 3, as I would expect. In PostgreSQL, it returns 1 and 1. So what is the difference between CHAR_LENGTH and LENGTH in Postgres? SELECT DATALENGTH(N’你’), LEN(‘你’); The above is SQL Server, but returns 2 and 1. Why the difference? sql mysql sql-server postgresql
Selecting the number of users who appear more than once
For simplicity, assume table has user_id and transaction_id.