is there a difference between specifying the table-column after joining tables?
For example, in the below queries I selected the columns as b.refunded_at or refunded_at. The output the same, but I just want to make sure.
Thanks
SELECT billing_cycle_in_months,
MIN(DATEDIFF(refunded_at, settled_at)) AS min_days,
AVG(DATEDIFF(refunded_at, settled_at)) AS avg_days,
MAX(DATEDIFF(refunded_at, settled_at)) AS max_days
FROM noom_signups AS a
JOIN noom_transactions AS b ON a.signup_id = b.signup_id
JOIN noom_plans AS c ON a.plan_id = c.plan_id
WHERE started_at >= 2019-01-01
GROUP BY 1;
and
SELECT billing_cycle_in_months,
MIN(DATEDIFF(b.refunded_at, b.settled_at)) AS min_days,
AVG(DATEDIFF(b.refunded_at, b.settled_at)) AS avg_days,
MAX(DATEDIFF(b.refunded_at, b.settled_at)) AS max_days
FROM noom_signups AS a
JOIN noom_transactions AS b ON a.signup_id = b.signup_id
JOIN noom_plans AS c ON a.plan_id = c.plan_id
WHERE a.started_at >= 2019-01-01
GROUP BY 1;
>Solution :
Tables do not have to be specified so long as the column names are unambiguous.