When a market order is placed, it is executed at the best available bid/offer on the exchange. If the existing bids/offers do not have enough quantity to fulfil the order, the remaining unexecuted quantity will be matched against the next best bid/offer.
Here is an example of the market depth for ITC, assuming a market order is placed to buy 3500 shares:
108 shares will be purchased at a price of 263.20.
934 shares will be purchased at a price of 263.30.
The remaining 2458 shares will be purchased at a price of 263.35.
The same concept applies to limit orders in a different way. In the above example, if a limit order is placed to buy the 3500 shares at 263.20, then 108 shares would be bought immediately. However, the remaining 3392 shares would remain as a pending order in the order book. If any offer at the specified price comes in, the order will be executed. To learn more about limit and market orders, see
What are limit and market orders?