Assuming that you have a database, which contains a table, called books. Assume
ID: 3859588 • Letter: A
Question
Assuming that you have a database, which contains a table, called books. Assume that the books table was created with the DDL create statement below and contains the values listed in the following table. Develop a SQL update statement that will change the cost column of each row in the table, which has a publication date before 10/01/2009 to a value of $0.00. Post your solution to the discussion forum and compare with the solutions of your peers. Discuss different approaches to solving this problem.
Explanation / Answer
HI,
The images attached to the question are not loading. Please find the query below based on the requirement.
For oracle DB:
update tablename set columnname='0.00' where publicationDate > '10/01/2009';
If the date is of date format use below:
update tablename set columnname='0.00' where CAST(publicationDate AS DATE) > '10/01/2009';
For mysql use below:
update tablename set columnname='0.00' WHERE Date(publicationDate) = '2013-06-01';