SQL IN – dla dociekliwych

next level sql in

Wyrażenie IN w SQL’u pozwala uprościć przekazywanie do zapytania listy warunków.

Wyobraź sobie, że tabele z markami samochodów. Do głowy powinny Ci przyjść nazwy najbardziej popularnych producentów: Volvo, Tesla, Audi, Volkswagen, Ford, Toyota, Honda itd. Chciałbyś ograniczyć listę wyników tylko do trzech najbardziej popularnych w Polsce marek: Toyota, Volkswagen i Audi.

Read More

How to delete small portion of data from BIG table?

You have a big table. The biggest in your system.

You may say big table, big fun but also in some situation a big challenge.

The manager gives you a task:

  • Delete a small portion of data from this table. Only about 1% of rows need to be removed.
  • How would you approach this task?

    What query will you build? How would you minimize logical reads? Would you approach this task differently if it was a one time activity or task executed on a regular basis?

    Consider: is this table used exclusively used by you? Maybe in parallel, some other process execute inserts into this table?

    Continue reading to see how to delete data in batch on SQL Server.

    Read More