Skip to content

Tag: row

How to delete row contain specific string on it in SQL Server

There are lots of rows that contain ’08:28:00.000′ in my table,like this one: I want to delete all the rows that ‘datetime’ contains ’08:28:00.000′.Instead of deleting this kind of rows one by one,is any command can delete all the rows than datetime contain ’08:28:00.000′? Answer Try using a range delete query here, after extracting time from the datetime column:

How to calculate the average value of following n rows based on another column – SQL (Oracle) – updated version of previously answered question

I am trying to calculate average monthly value of PREMIUM for each POLICY_ID in monthly basis as shown below screenshot. When a customer updates his/her yearly PAYMENT_FREQUENCY to a value different than 12, I need to manually calculate the average monthly value for the PREMIUM. In addition, average monthly PREMIUM amount can be changed in time. For instance, for the