INSERT INTO reports (id, date, message)
VALUES ($1, $2, $3)
RETURNING id
是否可以将($1, $2, $3)
替换为更简单的内容,例如?
或*
?有点令人沮丧-输入所有值。
答案 0 :(得分:0)
您可以使用namespace Enums
{
public enum ComputerTypes
{
Laptop,
Desktop
}
public enum Brands
{
APPLE,
DELL
}
public enum Processors
{
I3,
I5,
I7
}
}
语法:
INSERT INTO SELECT FROM VALUES()
示例演示:
INSERT INTO reports (id, date, message)
SELECT col1, col2, 'const_value'
FROM (VALUES (...,...),
(...,...)) s(col1, col2, ...,coln)
RETURNING id;