Databases for Windows  /   Database Blog  /   Organizer Advantage, Handy Library, SQL Tutor   /  SQL Tutor, UPDATE
28/05/2024

SQL Update Function


Be careful when updating records in a table!

Update

The SQL Update function is used to modify existing records in a database table. It allows users to update specific columns or fields with new values based on certain conditions.

Update, Example 01

Using the Update Function to Define Values for Call Number. Let's say we want to update the call numbers in our library database using the first three letters of the author's last name. We can achieve this using the SQL Update function with the following query:

UPDATE library SET call_number = Substringng(author from 1 for 3);

UPDATE library SET call_number = Left(author from 1 for 3);

In this example, the Update function sets the call_number field in the library table to the first three letters of each record's author's last name (entries are 'last name, first name').

Copyright © 2024 · All Rights Reserved · PrimaSoft PC