No, not at all. In reality, a column reference in SQL should always be qualified -- meaning that it should say what table it comes from. You can think of the unqualified names as a short-hand. The SQL engine does the favor of figuring out the table when it can. And when a column is in multiple tables, it cannot figure it out.
Your queries should be readable and unambiguous. In your case, your code should look something like this:
select c.cname
from college c join
apply a
on c.cname = a.cname
where c.enrollment > 2000 and a.major = 'CS';
Note: This is guessing where enrollment
and major
are coming from, because there is not enough information in your query to figure this out.
Also, this uses proper, explicit, standard, readable JOIN
syntax. Never use commas in the FROM
clause, even if your course/tutorial materials do so. In fact, that alone suggests that they are way out-of-date (decades old).
Also, use table aliases (the abbreviations) so queries are simpler to write and to read.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…