# Drop table
DROP TABLE dbo.data_table_name;
# to rename variable name in the column
UPDATE dbo.grain_yield_rh_21
SET location = 'new name'
WHERE location = 'current name';
# data summary
WITH yield_mean_rs23 AS (
SELECT
row,
AVG(Grain_yield_Mg_ha) AS yield_mean,
STDEV(Grain_yield_Mg_ha) / SQRT(COUNT(*)) AS yield_se
FROM dbo.grain_yield_rs_23
GROUP BY row
)
SELECT * FROM yield_mean_rs23;
WITH N_mean_rs23 AS (
SELECT
row, growing_stage,
AVG(Nitrogen) AS N_mean,
STDEV(Nitrogen) / SQRT(COUNT(*)) AS N_se
FROM dbo.plant_nutrients_rs_23
GROUP BY row, growing_stage
)
SELECT * FROM N_mean_rs23;
WITH yield_mean_rs23 AS (
SELECT
row,
AVG(Grain_yield_Mg_ha) AS yield_mean,
STDEV(Grain_yield_Mg_ha) / SQRT(COUNT(*)) AS yield_se
FROM dbo.grain_yield_rs_23
GROUP BY row
),
N_mean_rs23 AS (
SELECT
row, growing_stage,
AVG(Nitrogen) AS N_mean,
STDEV(Nitrogen) / SQRT(COUNT(*)) AS N_se
FROM dbo.plant_nutrients_rs_23
GROUP BY row, growing_stage
)
SELECT
N_mean_rs23.row, N_mean_rs23.growing_stage,
N_mean_rs23.N_mean, N_mean_rs23.N_se,
yield_mean_rs23.yield_mean, yield_mean_rs23.yield_se
FROM N_mean_rs23
INNER JOIN yield_mean_rs23 ON N_mean_rs23.row = yield_mean_rs23.row;