现有两个表:Projects 和 Revenue,记录了项目的信息和每年的收入数据。
CREATE TABLE Projects (
ProjectID INT PRIMARY KEY,
ProjectName NVARCHAR(100),
ProjectManager NVARCHAR(100)
);
CREATE TABLE Revenue (
RevenueID INT PRIMARY KEY,
ProjectID INT,
RevenueYear INT,
RevenueAmount DECIMAL(10, 2)
);
INSERT INTO Projects (ProjectID, ProjectName, ProjectManager) VALUES
(1, 'Project A', 'John Doe'),
(2, 'Project B', 'Jane Smith'),
(3, 'Project C', 'Alice Johnson');
INSERT INTO Revenue (RevenueID, ProjectID, RevenueYear, RevenueAmount) VALUES
(201, 1, 2022, 20000.00),
(202, 1, 2023, 25000.00),
(203, 2, 2022, 15000.00),
(204, 2, 2023, 18000.00),
(205, 3, 2023, 30000.00);