Study Notes of Sqlite

SELECT from nothing?

It’s not consistent across vendors - Oracle, MySQL, and DB2 support dual:

1
2
SELECT 'Hello world'
FROM DUAL

…while SQL Server, PostgreSQL, and SQLite don’t require the FROM DUAL:

1
SELECT 'Hello world'

MySQL does support both ways.

mybatis batch insert oracle table ID use sequence return ID NULL

MyBatis 3.3.1 批量插入多行回写自增id

1
2
3
4
5
6
7
8
9
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_user
(name, password,age, email,gender,register_time)
VALUES
<foreach collection="list" item="user" index="index" separator="," >
(#{user.name},#{user.password},#{user.age},#{user.email},
#{user.gender},#{user.registerTime})
</foreach>
</insert>

关键:useGeneratedKeys="true", keyProperty="id"