Skip to content

Why doesn’t SET and CONVERT work for updating a table in MYSQL

I have the following code, with the column SaleDate in a datetime format, and I am trying to update it in the table to a date datatype instead and I’ve tried both cast and convert, but neither modifies the table, does anyone know what’s wrong? Answer You need to ALTER the table structure for that:…

How to display T-SQL in html with proper formatting?

I’m sure this has to be a duplicate, but I guess my searching skills aren’t on point today. I want to display SQL code in html (like in blogs and such), and I want it to be formatted like you would see it in Management Studio or any other editor that supports SQL. I’ve found a nuget package …

Not less than operator

In snowflake how do I use a not less than operator? If I want to return all rows that are not less than a value? Not sure if I want to use >= and tried !< but doesnt work Thank Answer There no “not less than” operator, but it’s logically the same as “greater than or equal to&#822…

Average open bug life in days

I am looking to identify the average life time in days for open bugs based on severity. bug severity status date_assigned 1 A open 2021-9-14 1 A in progress 2021-9-15 1 A fixed 2021-9-16 1 A verified 2021-9-17 1 A closed 2021-9-18 2 B opened 2021-10-18 2 B in progress 2021-10-19 2 B closed with fix 2021-10-20…

Finding Occurrence of the duplicate values

I have table with 3 columns (id, Name, Occurrence), I want to update the Occurrence column ,based on the id column, attached snap for the reference. for example if my id column has “606” value 3 times then my occurrent column should have 3 against all the “606” value. Below is the meth…

Order By Month Name – Postgresql

I followed this post Order by using month name in PostgreSQL but not success! I have a query (its working) and I just need to order the results by mont name. This is thr query I am using: I am trying: If i use order by mes_2021 Answer One trick is to use a window function on the date: This,

savepoint in sql

Can I rollback to a savepoint ( which was done before a commit ) in SQL ? Answer You can use the ROLLBACK TO SAVEPOINT statement only in the transaction. In MySQL documentation (https://dev.mysql.com/doc/refman/8.0/en/savepoint.html) you find: All savepoints of the current transaction are deleted if you execu…