teach-ict.com logo

THE education site for computer science and ICT

3. Updating data

Below is a typical database table.

a table

It is made up of a number of rows with each row made up of a number of fields. In this case the fields are ID, Username, Password, Active

 

The action of changing existing data in a table is called an update.

Normally an update operation is limited by setting a criteria. A criteria sets out a rule that must be met before an update is carried out.

For example, here is some database command pseudocode

UPDATE Password TO 'mypassword' WHERE ID IS 23393

The field called 'Password' is to be updated with the value 'mypassword' but the WHERE is setting out a criteria, in this case only the row which has an ID field value of 23393.

If you carried out the operation without any criteria, the command would set every password to 'mypassword' instead.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: database Update operation examples