MySQL SET NAMES
MySQL SET NAMES is a SQL statement in the MySQL Specific category. MySQL: sets the character set and collation for the current connection. Affects how data is sent/received. The syntax is SET NAMES 'charset' COLLATE 'collation';. It returns charset configured. A typical example: SET NAMES 'utf8mb4' COLLATE 'utf8mb4_unicode_ci'; -- Sets client, connection, and results character set -- Equivalent to: SET character_set_client = utf8mb4; SET character_set_results = utf8mb4; SET character_set_connection = utf8mb4; SET collation_connection = utf8mb4_unicode_ci; -- Before queries: SET NAMES 'utf8mb4'; SELECT * FROM articles; -- Returns data in utf8mb4 encoding -- Check current settings: SELECT @@character_set_client, @@character_set_connection, @@character_set_results, @@collation_connection; A close relative is AUTO_INCREMENT, which mySQL auto-generates sequential integer values for this column. Commonly used with PRIMARY KEY. A close relative is ENGINE, which specifies the MySQL storage engine. InnoDB (default) supports transactions and foreign keys. MyISAM is faster for read-heavy. A close relative is LAST_INSERT_ID(), which returns the AUTO_INCREMENT value generated by the most recent INSERT in the current connection.