SQL: 如何在具有特定 ID 的特定列中插入数据

SQL: How to insert data in specific column with specific id as well

是否可以对单个 table 执行那种查询?

我读到它可以通过多个 table 来完成(通过从第二个中选择特定值插入第一个 table)

INSERT INTO Customers (CustomerName, Country)
SELECT SupplierName, Country FROM Suppliers
WHERE Country='Germany';

Is it possible to perform kind of that query on single table?

是的,有可能:

CREATE TABLE Customers(ID INT IDENTITY(1,1),
                       CustomerName VARCHAR(100), Country VARCHAR(100));

INSERT INTO Customers (CustomerName, Country)
VALUES ('John', 'USA'), ('Martin','Germany');

INSERT INTO Customers (CustomerName, Country)
SELECT CustomerName, Country 
FROM Customers
WHERE Country='Germany';

SELECT *
FROM Customers;

LiveDemo

请记住,需要 Table Spool 以避免 Halloween Effect