Skip to content

Tag: sql

SQL – updating column based on next row value

I have a table, and the requirement is to update column ‘val’ based on the value in the column ‘val’ in next row (ordered by by id). Table is shown below : I’m able get the select query to get the next value, however the update query is not working. Here is the select query (work…

Kubernetes Whitelist Alternative SQL Server

We have a SQL Server hosted on a cloud VPS and a kubernetes cluster hosted on Digital Ocean. I am using their kubernetes offering. Our server the SQL Server sits on, has firewall rules to only allow whitelist IPs to connect to the SQL Server. So currently we add the IPs to each of the kubernetes nodes so they…

Efficient syntax to update 5K rows in BQ table

I’m trying to update ~5K rows in bq using python client. Here is my current try: and How can I map the account id list to a string as follows which seems more efficient(?) UPDATE mytable SET somefield=( CASE WHEN (id=100) THEN ‘some value removed’ WHEN (id=101) THEN ‘some value removed…