declare @t table(name varchar(),type int) insert into @t union all union all union all union all if object_id('test1') is not null drop table test1 create table test1( name varchar(), type int) insert into test1 union all union all union all union al…
<select id="findActiveBlogLike" resultType="Blog"> SELECT * FROM BLOG WHERE <if test="state != null"> state = #{state} </if> <if test="title != null"> AND title like #{title} </if> <…
需求:查出给定id的记录: <select id="getEmpsByConditionForeach" resultType="com.test.beans.Employee"> SELECT * FROM tb1_emplyee WHERE id IN <foreach collection="list" item="item_id" separator="," open="…
SQL删除数据的各种方式总结 一.使用DELETE从表中删除目标行.记录每次删除操作.如: USE pubs DELETE FROM authors WHERE au_lname = 'McBadden' 二.使用DROP TABLE 来实现整表的删除,整个表的结构都被删除.如: USE PUBS DROP TABLE AUTHORS 三. 使用DROP DATABASE 来实现整个数据库的删除.如: USE PUBS DROP DATABASE PUBS 四.使用TRUNCATE TABLE…