Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Wednesday, May 28, 2008

UPDATE information in a database - SQL Tutorial

Updating information in a database is simple also. Last time you can see that we left off Jack's age. We found out it was his 23rd birthday last month, so now we can add this to the database. We'll do that simply by using an UPDATE statement to update his information.

UPDATE Persons SET Age=23 WHERE Name='Jack Smith'

If you're scared of there being two Jack Smiths, you might also add , Level='Level 8 to that statement. If you have two Level 8 Jack Smiths, then you really aught to learn a little about creating ids, so that you can only update the correct Jack.

Data Manipulation Language (DML) - Part of SQL

SQL allows you to manipulate data, which is really important. Let's say John's rank goes down and we need to change it to "Level 3" instead of "Level 5". We would use the UPDATE command to change his information.

SELECT - Retrieves information from the database for you.
UPDATE - Updates information in the database for you.
DELETE - Deletes data specified in the database.
INSERT INTO - inserts a new row of data in the database.