How to get a new column without using update(plz check with the requirment)
write a query to display current sal and new sal for all employees
condition
if job='MANAGER' and deptno in (10,20) then make newsal increased by 15% to current salary.
if job !='MANAGER' and deptno in (10,20) then make newsal increased by 25% to current salary.
Hi,
Here's one way to do it:
SQL> select empno,ename,job,deptno,sal, case
2 when job='MANAGER' and deptno in (10,20) then 1.15 * sal
3 when job <>'MANAGER' and deptno in (10,20) then 1.25 * sal
4 else
5 sal
6 end as new_sal
7 from emp ;
EMPNO ENAME JOB DEPTNO SAL NEW_SAL
7369 SMITH CLERK 20 800 1000
7499 ALLEN SALESMAN 30 1600 1600
7521 WARD SALESMAN 30 1250 1250
7566 JONES MANAGER 20 2975 3421,25
7654 MARTIN SALESMAN 30 1250 1250
7698 BLAKE MANAGER 30 2850 2850
7782 CLARK MANAGER 10 2450 2817,5
7788 SCOTT ANALYST 20 3000 3750
7839 KING PRESIDENT 10 5000 6250
7844 TURNER SALESMAN 30 1500 1500
7876 ADAMS CLERK 20 1100 1375
EMPNO ENAME JOB DEPTNO SAL NEW_SAL
7900 JAMES CLERK 30 950 950
7902 FORD ANALYST 20 3000 3750
7934 MILLER CLERK 10 1300 1625
14 rows selected.
SQL>If your requirements aren't satisfied, let me know it.
Edited by: Manguilibè KAO on 18 janv. 2012 03:16
Similar Messages
-
How to display row to columns without using pivot keyword
hi,
could someone help me how to dispaly rows into columns without using pivot keyword and actuall my scenario is,iam having two tables with names and sample data is shown below
ID PROJECT MID MINAME TASKID TASKNAME
1 PROJ1 1 AA 100 PR1_TASK1
1 PROJ1 3 CC 102 PR1_TASK3
1 PROJ1 4 DD 103 PR1_TASK4
1 PROJ1 5 EE 104 PR1_TASK5
1 PROJ1 6 FF 105 PR1_TASK6
2 PROJ2 5 EE 114 PR2_TASK1
2 PROJ2 6 FF 115 PR2_TASK2
2 PROJ2 7 GG 116 PR2_TASK3
2 PROJ2 8 HH 117 PR2_TASK4
2 PROJ2 9 JJ 118 PR2_TASK5
2 PROJ2 10 KK 119 PR2_TASK6
2 PROJ2 1 AA 120 PR2_TASK7
The output should display project and count of tasks in particular milestone as shown below
project AA BB CC DD EE FF GG HH JJ KK
1 2 0 1 5 3 2 0 2 1 0
2 1 2 0 2 1 0 2 4 3 1
Thanks in advance ,
vvrWITH t1 AS
(SELECT 1 ID,
'PROJ1' PROJECT,
1 MID,
'AA' MINAME,
100 TASKID,
'PR1_TASK1' TASKNAME
FROM DUAL
UNION
SELECT 1, 'PROJ1', 3, 'CC', 102, 'PR1_TASK3'
FROM DUAL
UNION
SELECT 1, 'PROJ1', 4, 'DD', 103, 'PR1_TASK4'
FROM DUAL
UNION
SELECT 1, 'PROJ1', 5, 'EE', 104, 'PR1_TASK5'
FROM DUAL
UNION
SELECT 1, 'PROJ1', 6, 'FF', 105, 'PR1_TASK6'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 5, 'EE', 114, 'PR2_TASK1'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 6, 'FF', 115, 'PR2_TASK2'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 7, 'GG', 116, 'PR2_TASK3'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 8, 'HH', 117, 'PR2_TASK4'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 9, 'JJ', 118, 'PR1_TASK5'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 10, 'KK', 119, 'PR1_TASK6'
FROM DUAL
UNION
SELECT 2, 'PROJ2', 1, 'AA', 120, 'PR1_TASK7' FROM DUAL)
SELECT id project,
NVL((SELECT mid
FROM t1
WHERE miname = 'AA'
AND id = t_out.id),
0) AA,
NVL((SELECT mid
FROM t1
WHERE miname = 'BB'
AND id = t_out.id),
0) BB,
NVL((SELECT mid
FROM t1
WHERE miname = 'CC'
AND id = t_out.id),
0) CC,
NVL((SELECT mid
FROM t1
WHERE miname = 'DD'
AND id = t_out.id),
0) DD,
NVL((SELECT mid
FROM t1
WHERE miname = 'EE'
AND id = t_out.id),
0) EE,
NVL((SELECT mid
FROM t1
WHERE miname = 'FF'
AND id = t_out.id),
0) FF,
NVL((SELECT mid
FROM t1
WHERE miname = 'GG'
AND id = t_out.id),
0) GG,
NVL((SELECT mid
FROM t1
WHERE miname = 'HH'
AND id = t_out.id),
0) HH,
NVL((SELECT mid
FROM t1
WHERE miname = 'JJ'
AND id = t_out.id),
0) JJ,
NVL((SELECT mid
FROM t1
WHERE miname = 'KK'
AND id = t_out.id),
0) KK
FROM (SELECT DISTINCT id FROM t1) t_out
PROJECT AA BB CC DD EE FF GG HH JJ KK
1 1 0 3 4 5 6 0 0 0 0
2 1 0 0 0 5 6 7 8 9 10As I understand, you want MID of MINAMEs displayed ? But output is not like yours.. What is exactly your requirements? -
My old computer crashed and I had to get a new one. I was unable to save anything from the old computer. Is there anyway to get my music from my Ipod to my new computer without having to start over with the old cd's again
Hello cheech07,
The following article contains directions that can help get you back on track with iTunes. I'd recommend picking up at 'Part 5' of the 'External drive' section.
iTunes: How to move your music to a new computer
http://support.apple.com/kb/HT4527
Cheers,
Allen -
How can i join additional column without using a query
Hi,
I created a report using a base query; Now i want to add an additional coloumn to it without using another table i.e. from no new query; That additional column is complex computed value from different tables created for each record; How can i attach it to each record;
thanks in advance
prasanthAdd a formula column in your existing query.
-
How to get an iTunes Match without using a credit card
I'm from Mexico and I'm seventeen. How can I join the iTunes Match without using a credit card? I've bought an iTunes Card but I'm not sure if I'm able to buy the subscription for a year with it. I CAN'T FIND THE COMMUNITY SUPPORT IN ESPANISH :@! Lucky I speak two languages...
The only options for purchases from iTunes are credit/debit cards or iTunes Gift cards.
-
How to get a new iTunes without losing my stuff on my iPhone
So When updating my phone last time My dad synced all our phones together and I discounted my phone from our cloud and then locked us all out of our itunes. Should have been an easy fix but I was 13 when I made our itunes account (now 18) and do NOT remember my answer for the security questions at all and therefore none of us can not get into our itunes and that means I have not been able to update my phone since September and its running so slow. I really wanna just get a new itunes account but I really don't want to lose any of my apps or pictures on my phone. Can someone please help me!
When you sync the iPad 1 to iTunes it should copy all of the items from the iPad into iTunes.
However, you can connect your iPad 1 to your computer, launch iTunes, right click on the device name on the left side of iTunes and select Transfer Purchases. This will transfer all paid apps, movies, music etc into iTunes. The you can sync the iPad 1 to iTunes one last time to make sure all content is backed up.
This talks about transferring purchases.
http://support.apple.com/kb/ht1848
Disconnect iPad 1, connect iPad 2, select all of the stuff that was on iPad 1 and sync.
Message was edited by: Demo -
How will it be possible to to use a firewire external with the new iMac
I see the new iMac has four USB 3 ports and two Thunderbolt ports.
I have numerous FW 800 externals I use for back up, Time Machine and so forth (many are less than a year old and were not inexpensive).
When I get a new iMac, what will be the process or procedure to use one or more of those Firewire externals with the new iMac?Try http://store.apple.com/us/product/MD464ZM/A
This Thunderbolt to Firewire adapter should do it for you.
Allan -
HT1444 How to install a new OS without using the Mac App Store
I am running OS 10.5.8 on a refurbished Macbook Pro. I am not running an OS early enough to be able to use the Mac App Store. Everytime I go under Software Update it says everything is up to date. I would like to put the latest OS on this computer, but must install 10.6 first (apparently)?? My only question is how?
Welcome to the Apple Support Communities
To have the App Store, you need Mac OS X Snow Leopard, and you can't get it from Software Update because it's a paid upgrade. Buy it from the Apple Online Store > http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard
Then, make a backup of your files with Time Machine and/or Carbon Copy Cloner, insert the DVD and follow the steps to upgrade to Snow Leopard. After upgrading, open > Software Update to install 10.6.8, so you will get the App Store.
To upgrade to OS X Mountain Lion, just open the App Store and purchase it. Check that your applications are compatible > http://www.roaringapps.com When it finishes downloading, just follow the steps to upgrade to Mountain Lion. You can check the OS X Mountain Lion requirements > http://www.apple.com/osx/specs -
How to get username from audible account if one is associated with the store account
So, I noticed, while de-authorizing a previous computer of an itunes store account, that an audible account was available for deauthorization as well. I never authorized an audible account, and I'm not getting any help from apple about retaining a username if you never created one. shady
Have you ever had an account with audible.com ? If not then you won't have one to deauthorise - the option to deauthorise one shows in the Advanced menu on my iTunes, even though I haven't currently got one authorised on it. If you have got an audible account and you have authorised it on that computer then Apple won't know what it is, as the account would be with audible.com, not Apple.
-
How to Create a new column from two different result sets
How to Create a new column from two different result sets, both the result set uses the different date dimensions.
i got solutions for this is apply filters in column formula it self, based on the requirement.
-
How to auto update date column without using trigger
Hi,
How to write below MYSQL query in Oracle 10g :
CREATE TABLE example_timestamp (
Id number(10) NOT NULL PRIMARY KEY,
Data VARCHAR(100),
Date_time TIMESTAMP DEFAULT current_timestamp on update current_timestamp
I need to auto update the Date_Time column without using trigger when ever i update a record.
Example shown below is from MYSQL. I want to perform the below steps in ORACLE to auto update Date_Time column.
mysql> INSERT INTO example_timestamp (data)
VALUES ('The time of creation is:');
mysql> SELECT * FROM example_timestamp;
| id | data | Date_Time |
| 1 | The time of creation is: | 2012-06-28 12:37:22 |
mysql> UPDATE example_timestamp
SET data='The current timestamp is: '
WHERE id=1;
mysql> SELECT * FROM example_timestamp;
| id | data | Date_Time |
| 1 | The current timestamp is: | 2012-06-28 12:38:55 |
Regards,
Yogesh.Is there no functionality in oracle to auto update date column without using trigger??
I dont want to update the date column in UPDATE statement.
The date column should automatically get updated when ever i execute an Update statement. -
How can I create a new entry without using LOV for foreign keys.
Referring to TUHRA sample application based on HR database schema. JDeveloper 10.1.3.0.4
How can I create a new employee without using LOV for the foreign key "job_id".
On the first page I would like to choose the job_title from adf read-only table.
After clicking on the "create new employee button" a creation form appears in which the job_id field is set with previous selection.
Regards M.Winkler
Edited by: user3541283 on 06.10.2008 03:44
Edited by: user3541283 on 06.10.2008 03:50Hi,
usually the foreign key is only set if the VO you select is dependent from a master. If e.g. you have DepartmentsVO1 that has an EmployeeVO3 as its nested VO, then creating a new instance of employees automatically add the foreign key. If you add EmployeesVO1, which is not dependent to DepartmensVO1, then the foreign key is not set. So if this is the case in THURA (keep in mind that this is not an Oracle demo but a sample used in a book about ADF) then all you need is to take the independent VO when building the new employee form.
Frank -
How do I get rid of the alert "(Java Scriprt Application)Type error: Text is undefined> I get it when I get a new Internet page using Firefow
I do not want to half to install things into my PC that i do not trust! I just want this gone and like i said Firefox should of given us the choice to add this and not forced us, because if there is no actual way to remove it then il be forced to remove Firefox till they either remove it or allow us to remove it!
-
When I open a pdf file, after a few seconds, it hides the toolbar and I don't know how to get it back. I use multiple monitors and, without being able to grab the toolbar, I am unable to move the pdf file to a different monitor. How do I stop this?
Does Firefox switch to full screen if you press F11 ?
You can also try the F10 key to see if that brings up the menu bar.
* If the above steps didn't help then see http://kb.mozillazine.org/Corrupt_localstore.rdf
Note: Do not delete localstore.rdf in the program folder (Windows: "C:\Program Files\Mozilla Firefox\defaults\profile\") (Mac: "/Applications/Firefox.app/defaults/profile/") -
Why can't I use my VTone I just purchased from Verizon Market as my phone ringer? It game me an option to mark it as my default ringer but when I go to 'settings' it only gives me the same generic ringtones, how do i get my new ringtone to use?
I like to customize my phone with ring tones too! Let’s get this working for you.
Did you purchase the ring tone on our website or on the phone?
If it was purchased online the ring tone is sent to you in a message and you need to save the ring tone first http://bit.ly/PKUfUg and it is saved as a ring tone you can go in and set it as your default ring tone http://bit.ly/R5Xa4o.
If the ring tone was purchased on the phone you just need to go into your ring tone to set it up http://bit.ly/R5Xa4o.
Hope this is helpful. Keep me posted if you need further assistance.
John B
Follow us on Twitter @VZWSupport
Maybe you are looking for
-
How to draw nice lines in faces-config.xml page flow?
hi, I would like to be able to split the line connecting the pages in any point with a view to "beautifying" the diagram, and perhaps rearranging the flow so it looks more professional. Is that possible and how? thanks,
-
I hope that some of you brains out there can help me with this one. I have a Zoom Q3HD camera that I bought to record movies of our band. It records with a .mov suffix and when downloaded opens fine with Quicktime. Quicktime is showing that the forma
-
Error 13019 w/o synced music/v-notes/etc
I am getting the 13019 error when I connect my iPod to my computer. Here is the issue, I have tried the steps on the support page (http://support.apple.com/kb/TS2830) but I don't actually have any synced content. I manually move everything over (no s
-
Stuck with date from IPTC core
I usually change date from template when not corresponding to real one, and succesfully. Now doesn't work, daTE is stuck at date at IPTC core, and I can actually change from there but I prefer to change from template (small icon top right) I did too
-
Open & quit app with single key
hello i'm looking for a way to open & quit an app with a assigned key (on the keyboard). so let's say, if i press "A" it opens up photoshop and if i press it again it would close it. any idea? any suggestion? thanks a lot