Mining when there is no transaction what happens when there is noone doing transactions and miners mine the blocks? Can they mine empty blocks? And how it works when there won't be any hash in empty block or there is a hash?

Thank you
Can they mine empty blocks?


The miner must include a coinbase transaction (which determines the mining reward), or the block will be rejected by the network. That way, the miner is awarded coins for solving a block (even if it contains no other transactions) and coins are distributed according to consensus rules.


  And how it works when there won't be any hash in empty block or there
  is a hash?


There is still other data that is hashed, including:

version, previous block hash, merkle root, unix epoch time, difficulty target (bits), and nonce.

The merkle root including only the coinbase transaction in this example.