Lab 12bUpdating a Record.pdf - Lab 12b – SQL Update...

This preview shows page 1 - 2 out of 4 pages.

CT044-3-1-IOOPLab 12bSQL UpdatePage 1 of 4__________________________________________________________________________________________Level 1Asia Pacific University of Technology and InnovationUpdating a RecordUpdating a record to a database requires the use of the UPDATE statement in SQL. TheUPDATE statement has the following syntax:UPDATEtable_nameSETcolumn_1 = [new value]WHERE{condition}wheretable_nameis the name of the table to insert,column_1is the name of the column(s)where the new value(s) are to be updated and theconditionis the search criteria for locatingthe record to be updated.Example 1:Assume we have a table of monthly sales calledStoresStore_name SalesDatePulau Pinang 150000 Jan-05-2011Kuala Lumpur 250000 Jan-04-2011Petaling Jaya 130000 Jan-03-2011Melaka75000 Jan-08-2011and there is an error in the sales amount entered for Melaka which should be 95000 instead of75000. To update the information using the UPDATE statement:UPDATE StoresSET Sales = 95000WHERE Store_name = “Melaka”Example in VBAssuming we have a Windows Form which allows users to change their password for a loginaccount. This scenario assumes that the user already logged into the system and is ready tochange the password.:

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 4 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
N/A
Tags
Articles with example SQL code, Asia Pacific University of Technology and Innovation, use of the UPDATE statement

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture