Why de is used in second sentence?


I am currently studying Minna no nihongo. I came across these two sentences
[![enter image description
here](https://i.stack.imgur.com/K4q6G.jpg)](https://i.stack.imgur.com/K4q6G.jpg)

Why was de used in gakkodewa , instead of gakkoniwa in second sentence?




In these two examples, there are two main differences you should learn.

**に** in the first sentence is used to explain the location that something or
someone exists.

**で** in the second sentence is used to explain the location that an action
takes places.




In these two examples, there are two main differences you should learn.

**に** in the first sentence is used to explain the location that something or
someone exists.

**で** in the second sentence is used to explain the location that an action
takes places.

