Sql 增删改查语句

SQL SELECT 语句

SELECT 列名称 FROM 表名称
select * from att_address where 1=1  and ( name='刘中断' )  and ( phone1='13255667' or phone2='13255667') order by name asc

INSERT INTO 语句

INSERT INTO 表名称 VALUES (值1, 值2,....)

我们也可以指定所要插入数据的列:

INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
String strSql= "INSERT INTO att_address (id,name,phone1,phone2,address,remark,classify,operation) "
+ "VALUES ('"+id+"','"+name+"','"+phone1+"','"+phone2+"','"+address+"','"+remark+"','"+classify+"','"+operation+"' );";

UPDATE 语句

UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
UPDATE att_address set name='"+name+"',"+"phone1='"+phone1+"',"+"phone2='"+phone2+"' "+" where id='"+ id +"'"

DELETE 语句

DELETE FROM 表名称 WHERE 列名称 =
DELETE FROM att_address where id='"+ id +"'"

 

posted @ 2021-06-26 10:34  海乐学习  阅读(75)  评论(0编辑  收藏  举报