1、問題提出
在表中插入中文時,顯示亂碼。
2、問題解決
創建數據庫並指定編碼格式:
CREATE DATABASE world_test DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE world_test;
創建表格:
CREATE TABLE world_1(
city_id int not null auto_increment,
city_name char(50) not null,
date datetime not null,
city_price int not null
);
添加數據:
INSERT INTO world_1(
1,
'美國',
'2020-03-10',
12
);
查看數據:
SELECT * FROM world_1;
返回數據: