How to update specific employee in table in MySQL?

0

I have a database in SQL (banco_sql), where there is the employees table with 4 fields (ID, OFFICIAL, SALARY, DEPARTMENT).

ID        FUNCIONARIO        SALARIO        DEPARTAMENTO 
1         Pedro              1400           TI
2         Isabela            2500           Juridico
3         Guilherme          1700           TI
4         José               1800           Marketing  
5         João               2200           Juridico
6         Pedro              1300           Marketing

I would like to know how to update a certain employee's data (eg Salary)?

    
asked by anonymous 17.05.2016 / 13:48

1 answer

15

The answer is very simple: you just need to make a update in the funcionarios table and put the ID of the people whose salary will be edited.

Example:

UPDATE NOME_DA_TABELA 
SET CAMPO_QUE_SERÀ_EDITADO = NOVO_VALOR 
WHERE ID = 'ID_DA_PESSOA';

Then to view your data, just do a select :

SELECT * FROM NOME_DA_TABELA;
    
17.05.2016 / 16:04