在PostgreSQL中,COLLATE關鍵字用于指定排序規則,常見的用法包括:
SELECT * FROM table_name ORDER BY column_name COLLATE "collation_name";
CREATE TABLE table_name (
column_name VARCHAR COLLATE "collation_name"
);
CREATE INDEX index_name ON table_name (column_name COLLATE "collation_name");
SELECT * FROM table_name WHERE column_name = 'value' COLLATE "collation_name";
SELECT * FROM table1
JOIN table2 ON table1.column_name COLLATE "collation_name" = table2.column_name;