Editor

A raise for the London offices

Medium · Company database · UPDATE, Subqueries

Everyone who works in a department located in London gets a 5 percent raise: their new salary is the old salary times 1.05.

Update the employees table. Employees in other locations, and anyone without a department, keep their salaries.

After your SQL, this query shows

SELECT id, name, salary FROM employees ORDER BY id;
idnamesalary
1Meera Krishnan250000
2Daniel Okoye250000
3Sophie Laurent157500
4Rahul Bansal166000
5Hannah Schmidt110000
6Kenji Watanabe180000
7Thandiwe Nkosi126000
8Fatima Rahman180000
9Vikram Nair140000
10Laura Chen140000
11Arjun Patel95000
12Maria Gonzalez98000
13Ethan Brooks92000
14Zara Ahmed142000
15Oliver Hughes162750
16Priyanka Iyer89250
17Lucas Ferreira75600
18Nadia Petrova126000
19Samuel Adeyemi89250
20Grace Liu88000
21Mohammed Hassan76000
22Ines Moreau68000
23Joseph Mwangi90000
24Ana Reyes52000
25Carlos Mendoza52000
26Eva Novak135000
27Ravi Shankar105000
The company tables

assignments: 30 rows, first 5 shown

idemployee_idproject_idhours
181320
291410
3111380
4122290
5102150

departments: 8 rows, first 5 shown

idnamelocation
1EngineeringBengaluru
2SalesLondon
3MarketingLondon
4FinanceSingapore
5Human ResourcesBengaluru

employees: 27 rows, first 5 shown

idnamedepartment_idmanager_idjob_titlesalaryhire_date
1Meera KrishnanNULLNULLChief Executive Officer2500002015-03-01
2Daniel Okoye11Chief Technology Officer2500002015-03-01
3Sophie Laurent21Head of Sales1500002017-01-09
4Rahul Bansal41Finance Director1660002016-11-21
5Hannah Schmidt51Human Resources Manager1100002018-04-02

projects: 10 rows, first 5 shown

idnamedepartment_idbudgetstart_dateend_date
1Payments Platform14500002025-01-062025-09-30
2Mobile App Redesign13000002025-03-03NULL
3Data Warehouse13800002025-06-022026-03-31
4Spring Campaign3900002025-02-102025-05-30
5Partner Portal21500002025-04-142025-12-19
-- Write your SQL here