?
Solved

UPDATE statement

Posted on 2005-04-17
2
Medium Priority
?
317 Views
Last Modified: 2012-06-22
I am trying to UPDATE, how do I use percentage to increase let's say Salary by 10%.

Here's my table:

CREATE TABLE Employee
(
Social_security_number CHAR (11)  NOT NULL PRIMARY KEY,
Last_Name      VARCHAR(30)      NOT NULL,
First_name      VARCHAR(30)      NOT NULL,
Address            VARCHAR(50)      NOT NULL,
City            VARCHAR(30)      NOT NULL,
State            CHAR(2)            NOT NULL,
Zip_code      VARCHAR(10)      NOT NULL,
Telephone_area_code      CHAR(3)      NULL,
Telephone_number VARCHAR(8)      NOT NULL,
Email_address       VARCHAR(60)      NOT NULL,
Job_title_code        INTEGER          NULL,
Hire_date       DATETIME      NOT NULL,      
Salary             DECIMAL (9,2)      NOT NULL,
);
GO

Now the column:

INSERT INTO Employee
      (Social_security_number, Last_name, First_name, Address, City, State,
      Zip_code, Telephone_area_code, Telephone_number, Email_address, Job_title_code, Hire_date, Salary)
VALUES('224-55-1199', 'Arcadi', 'Joseph', '1 Mamorneck Way', 'Mamaroneck', 'CA', '98043-8043',
      '589', '985-9855', 'jarcadi@mamaroneck.com', '985', '6/14/1985', 764000.00);

This is what I've done, and I have been reading, playing around with it, but missing just the correct syntax. Any help would be greatly appreciated. :-)

UPDATE Employee
SET Salary * 10 PERCENT
WHERE Job_title_code = '985';
GO
0
Comment
Question by:novice35
2 Comments
 
LVL 37

Accepted Solution

by:
Harisha M G earned 1500 total points
ID: 13801040
Hi novice35,
    Salary * 1.1

10% = 10/100 = 0.1
10% increase = 1 + 0.1 = 1.1

Bye
---
Harish
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13801073
Based on mgh_mgharish's comment, your query will look like this:

UPDATE Employee
SET Salary = Salary * 1.1
WHERE Job_title_code = '985';
GO
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question