gpt4 book ai didi

MySQL:问号而不是符号

转载 作者:行者123 更新时间:2023-11-29 17:19:53 25 4
gpt4 key购买 nike

我在 MariaDB 中创建了一个数据库,然后运行一些 SQL 来创建表像这样:

    create table customers
( customerid int unsigned not null auto_increment primary key,
name char(50) not null,
address char(100) not null,
city char(30) not null
);

create table orders
( orderid int unsigned not null auto_increment primary key,
customerid int unsigned not null,
amount float(6,2),
date date not null
);

然后我尝试用一​​些数据填充它:

insert into customers values
(3, "Саша Валентей", "12, ул. Гудвина", "г. Изумрудный"),
(4, "Ева Легкая", "34, пр. Незнайки", "г. Солнечный"),
(5, "Слава Моргунов", "56, пер. Поттера", "пгт Хогвартс");

insert into orders values
(NULL, 3, 69.98, "2008-04-02"),
(NULL, 1, 49.99, "2008-04-15"),
(NULL, 2, 74.98, "2008-04-19"),
(NULL, 3, 24.99, "2008-05-01");

它是西里尔字母,如果这很重要的话。现在我有问号我的字符应该是。我的服务器是UTF-8,该表似乎是latin_swedish_ci。我该如何解决这个问题?

最佳答案

试试这个:

ALTER TABLE customers CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

关于MySQL:问号而不是符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51314666/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com