What is a bucket in database? I was implementing a code that involves a database and buckets. Just wanted to ask what is bucket and can someone describe it with an example?

Thanks!
In Oracle, one of the fundamental concepts for the CBO (Cost Based Optimizer) is that of the bucket. 

When collecting statistics about the distribution of data in a table (v. important for optimising the query plan) Oracle can split the data into buckets (or bands or segments) for the purpose of constructing histograms to determine the distribution of the data.

It can't really be better explained than here: 


  Data skew in a column can make it difficult for the optimizer to
  accurately estimate the cardinality of an operation. Without a
  histogram it will assume an even distribution amongst the distinct
  values for the column. 
  
  Take the case of a Yes/No flag for active
  records in a table. There may be 1 million rows in the table with only
  100 being marked as active. The optimizer would assume half are marked
  as "Yes" and half as "No", which would be a really bad assumption in
  this case. Histograms describe the distribution of data in a column,
  which helps identify data skew and allows the optimizer to make a
  better decision.


Checkout the links on the same page - oracle-base is a super site for all things Oracle by Tim Hall who really knows his stuff!

See here for a bit more detail, or Jonathan Lewis' site for in-depth information. Lewis is the CBO man - he literally "wrote the book" (Cost-based Oracle Fundamentals) about this (not bedtime reading! :-) ).