Help with SQL

I have a program that generated SQL for a report. I am not sure what "=" is for in the SELECT section of the query.  For example, the  "ctx_id = v_ctx_basic_info.ctx_id". Not sure what this is doing.   The query does do an inner join on two views by using the ctx_id, but what does this statement do "ctx_id = v_ctx_basic_info.ctx_id"?  Why do I need it?

	ctx_id = v_ctx_basic_info.ctx_id,  
	contract_type_Description = v_ctx_basic_info.contract_type_Description,  
	custom_1 = v_ctx_basic_info.custom_1,  
	Company_Name = v_ctx_basic_info.Company_Name,  
	expriation_date = v_ctx_basic_info.expriation_date,  
	product_description = v_ctx_basic_info.product_description
v_ctx_basic_info INNER JOIN v_ctx_custom on (v_ctx_basic_info.ctx_id=v_ctx_custom.ctx_id)

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

"ctx_id = v_ctx_basic_info.ctx_id" is simply  renaming the field ctx_id from table v_ctx_basic_info to ctx_id.
SELECT Superman = v_ctx_basic_info.ctx_id FROM v_ctx_basic_info
would result in:
Also, I would alias the views/tables in the queries to make them more readable. And, no. You don't need to rename the fields since the original fields are of the same name.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.