Link to home
Start Free TrialLog in
Avatar of Mounika Tirumala
Mounika Tirumala

asked on

sql query

how to write a query to genate a target column?

can any one help me
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A query is an inquiry into the database using the SELECT statement. A query is used to extract data from the database in a readable format according to the user's request.

It also could be used to create another table having a target column.

Q1: Could you possibly elaborate a bit as to what you want accomplish.
Q2: What is your source table and its column's names? Every query has to have at least one table to work with. Post it with sample data.

Mike
Avatar of Mounika Tirumala
Mounika Tirumala

ASKER

its not working even iam not getting the logic
Pls post your query .
SELECT * , ROW_NUMBER() OVER (Order By employee_id) rnk ,employee_ id= a * 12 FROM
employees
Avatar of ste5an
Please rephrase your question. More context is helpful.

And what does

to genate a target column?

mean?

SQL is a declarative language. It consists of DDL (data definition language) and DML (data manipulation language). A "query" normally denotes a SELECT statement to retrieve data. In this context, there is no "generate". You can only add new calculated columns as already shown in the posts before. SELECT is a DML statement.

On the other hand "generate" can denote creating a new column. This would be the ALTER TABLE statement, which is a DDL statement. E.g.

ALTER TABLE yourTable
ADD newColumnName INT NULL;