日期:2014-05-16 浏览次数:20949 次
总结一下常用的sql语句,测试版本:5.1
1.创建表
CREATE TABLE t_test ( id_ VARCHAR(32), title_ VARCHAR(255), content_ VARCHAR(2000), create_time_ VARCHAR(25), state_ VARCHAR(10) )
INSERT INTO t_test VALUES ('1', '标题','内容','2013-01-30','1') INSERT INTO t_test (id_,title_,state_) VALUES ('2', '标题2','0')
DELETE FROM t_test WHERE id_='2'
UPDATE t_test SET title_ = '标题改',content_='内容改' WHERE id_='1'
SELECT * FROM t_test WHERE id_='1' SELECT title_ AS 标题,content_ AS 内容 FROM t_test WHERE id_='1' SELECT * FROM t_test LIMIT 2,3 //从序号2开始,查3条记录,做翻页最简单