skip to Main Content

If I have query

SELECT FNAME, CNAME 
FROM FACULTY F, COURSES C 
WHERE F.FID=C.FID 
  AND COURSES.FID='F04';

so can i use COURSES.FID or once alias is there I should use only that.

though I am getting error if I am using table name instead of alias. Is it expected output?

2

Answers


  1. yes, it doesn’t conflict with any other aliases, you can use any aliases.

    SELECT F.FNAME, C.CNAME  FROM FACULTY F, COURSES C WHERE F.FID=C.FID AND C.FID='F04';
    

    but in your query, you should refer to columns from the COURSES table using the alias C. For this reason, in your query, you should use C.FID rather than COURSES.FID.

    Login or Signup to reply.
  2. Any of the both AliasName.ColName or TableName.ColName can be used. No change in the result or performance.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search