原表:
DROP TABLE IF EXISTS `sales`;
CREATE TABLE `sales` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fruit` varchar(32) DEFAULT NULL,
`amount` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
INSERT INTO `sales` VALUES ('1', 'apple', '13');
INSERT INTO `sales` VALUES ('2', 'orange', '2');
INSERT INTO `sales` VALUES ('3', 'pear', '19');
INSERT INTO `sales` VALUES ('4', 'banana', '4');
INSERT INTO `sales` VALUES ('5', 'cherry', '124');
INSERT INTO `sales` VALUES ('6', 'plum', '23');
要求:删除表中apple后面的13(就删除这一个单元格,apple这一行其它数据还保留),请问用什么语句。
DROP TABLE IF EXISTS `sales`;
CREATE TABLE `sales` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fruit` varchar(32) DEFAULT NULL,
`amount` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
INSERT INTO `sales` VALUES ('1', 'apple', '13');
INSERT INTO `sales` VALUES ('2', 'orange', '2');
INSERT INTO `sales` VALUES ('3', 'pear', '19');
INSERT INTO `sales` VALUES ('4', 'banana', '4');
INSERT INTO `sales` VALUES ('5', 'cherry', '124');
INSERT INTO `sales` VALUES ('6', 'plum', '23');
要求:删除表中apple后面的13(就删除这一个单元格,apple这一行其它数据还保留),请问用什么语句。
解决方案 »
- 哪位大侠 给我个 mysql 里实现查询汉字的拼音首字母 能用的
- mysql字符集问题
- 一台机子启用多个mysql ,Fatal error: Please read "Security" section of the manual to find
- 如何提高离散型数据表的查询速度?
- mysql的float数据格式
- 一个奇怪的sql 语句
- 关于C API连接数据库的问题,代码出错了,我改了1个星期没改出来,大家帮看看
- LINUX下JSP连接MYSQL的问题.......
- 求问mysql的navicat导入问题
- navicat 能不能给mysql的用户针对不同的表设置不同的权限?
- 这是什么错误,
- 取到一个字段替换当前列的另一个字段
他的正确叫法是字段(field)
你的要求是使用update 对该字段内容进行更新
可以使用update语句来完成
置于update语句怎么来完成请参考sql大全
+----+--------+--------+
| id | fruit | amount |
+----+--------+--------+
| 1 | apple | 13 |
| 2 | orange | 2 |
| 3 | pear | 19 |
| 4 | banana | 4 |
| 5 | cherry | 124 |
| 6 | plum | 23 |
+----+--------+--------+
6 rows in set (0.06 sec)mysql> alter table sales drop column amount;
Query OK, 6 rows affected (0.15 sec)
Records: 6 Duplicates: 0 Warnings: 0mysql> select * from sales;
+----+--------+
| id | fruit |
+----+--------+
| 1 | apple |
| 2 | orange |
| 3 | pear |
| 4 | banana |
| 5 | cherry |
| 6 | plum |
+----+--------+
6 rows in set (0.01 sec)mysql>
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
[url=http://community.csdn.net/Help/HelpCenter.htm#结帖]