1、update 基本用法:
UPDATE book SET cond = 'mint';
一般不要这么用,因为这会将一个column的所有行的cond设为 'mint'。
UPDATE book SET author = "Theodor Geisel" WHERE author = "Dr. Seuss";
2、在update中使用公式:
UPDATE loan
SET date_lent = DATE_ADD(date_lent, INTERVAL 1 YEAR)
WHERE date_lent = '2005-01-01';
3、删除行:
DELETE FROM book WHERE cond = 'poor';
如果省略 where 语句,则会删除掉所有列
4、从多个表中删除:
DELETE book, loan # tables to delete from
FROM book, loan # tables to use in WHERE clause
WHERE book.book_id = loan.book_id
AND book.cond = 'poor';
posted on 2007-09-18 18:31
Jeff Lee 阅读(135)
评论(0) 编辑 收藏 所属分类:
database