Search code examples
sqloracle-databasesql-updatesql-insertwhere-clause

Oracle SQL - Insert Statement with Where Clause


I'm trying to insert data into a particular column in a particular line in the table and I am sure I am doing something wrong since this is my first doing an Insert statement with Where:

insert INTO mekka_h_o_a_fees
  columns(money_handed_to_commity),
  Where Month_Year = July
  VALUES(Yes)

Thank you in advance


Solution

  • I think you want update, not insert. The syntax is:

    update mekka_h_o_a_fees
    set money_handed_to_commity = 'Yes'
    where month_year = 'July'
    

    This sets column money_handed_to_commity to 'Yes' on the row(s) where column month_year has value 'July'.