summaryrefslogtreecommitdiff
path: root/topics/next-gen-databases/sql-tricks.gmi
blob: 90f77278c51e9576d80e9da308310e1b1fad6e8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# This document has some useful SQL tricks

* Check the character set/collation a given table uses:

```
SELECT CCSA.* FROM information_schema.`TABLES` T,
       information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
  AND T.table_schema = "db_webqtl"
  AND T.table_name = "Investigators";
```

* Fixing broken character-sets:

```
ALTER TABLE Investigators CONVERT TO CHARACTER SET BINARY;
ALTER TABLE Investigators CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
```

Read the following for more details:

=> https://dev.mysql.com/blog-archive/debugging-character-set-issues-by-example/ Debugging character-set issues by example