How to update specific employee in table in Mysql?

Asked

Viewed 612 times

0

I have a database in SQL(banco_sql), where there is the employees table with 4 fields (ID, FUNCIO, SALARIO, DEPARTAMENTO).

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 data (ex: salary) of a certain official?

  • 3

    Only a mysql-Workbench tip is a modeling tool, your question is with production, ie only mysql, so I edited the question.

1 answer

15

The answer is very simple: you only need to make one update on the table funcionarios 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 make a select:

SELECT * FROM NOME_DA_TABELA;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.