How to achieve this scenario on SQL/SparkSQL/PySpark in Databricks I have a delta table named “test_table” in databricks like: