【发布时间】:2017-12-19 01:00:16
【问题描述】:
我已经创建了一个名为 Youtuber 的表,代码如下:
create table Channel (
codChannel int primary key,
name varchar(50) not null,
age float not null,
subscribers int not null,
views int not null
)
在此表中,有 2 个通道:
|codChannel | name | age | subscribers | views |
| 1 | PewDiePie | 28 | 58506205 | 16654168214 |
| 2 | Grandtour Games | 15 | 429 | 29463 |
所以,我想将“Grandtour Games”的年龄编辑为“18”。我怎样才能用update 做到这一点?
我的代码对吗?
update age from Grandtour Games where age='18'
【问题讨论】:
-
你知道一些我不知道的事情。你会如何使用
alter table来做到这一点? -
你说得对,我忘记了 alter table 仅适用于表名或列。谢谢
-
不要在标题中添加
(CLOSED),而是考虑删除问题。 -
Update channel set age = 18 where codChannel = 2 -
正确标记!!! MySQL SQL 服务器。这是哪一个??????
标签: sql sql-update alter-table