What is the value of comm and sal after executing the following query if the initial value of ‘sal’ is 10000?

UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;

sal = 11000, comm = 1000

Showing Answers 1 - 12 of 12 Answers

rahul tripathi

  • Sep 20th, 2005
 

It will give error that sal , comm appears more than once in the result collumn list

  Was this answer useful?  Yes

Alex Zyang

  • Apr 26th, 2007
 

This query will work fine
Sal = 1100
Comm = 100

  Was this answer useful?  Yes

NEHA

  • Oct 7th, 2007
 

SAL = 11000
COMM = 1100

  Was this answer useful?  Yes

it will give error becoz in update statement we only update one column once but in problem we r updating sal coll twice and comm colunm twice , so it will give error like 'duplicate column name'

  Was this answer useful?  Yes

query give wror about the data type


if you use this then give error of data type
update tablename set sal=sal+1000,com=sal*.1

you use this query

update tablename set sal=sal+1000,com=sal*10/100


, you use thsis query and your query will work fine

  Was this answer useful?  Yes

This Query will work fine.

SQL> select * from emp where sal=10000;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO GENDER
----- ---------- --------- ----- ----------- --------- --------- ------ ----------
7934 MILLER CLERK 7782 23/01/1982 10000.00 10 FEMALE

SQL>
SQL> UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1
2 where sal=10000;

1 row updated

SQL> select sal,comm from emp where empno=7934;

SAL COMM
--------- ---------
11000.00 1000.00

SQL>

  Was this answer useful?  Yes

Madhumita

  • Apr 26th, 2018
 

It will give
comm=1200 and sal=1000
I have executed and got the result in MySQL

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions