What is the difference between sand box and repository?
Sandbox is test environment provided to try out the things.
what are the advantages of repository instead of using Database?
Both, repository and database can be used to store a data. You can call "Repository" to environment where data is stored in files
and "Database", where data is stored in databases like MySql or Oracle.
Advantage of "Repository" here can be easy data modification.
Good, Better, Best, Don't take rest until, Good becomes Better, and Better becomes Best.
Sidd : (SCJP 6 [90%] )
It is rather hard to make suggestions without knowing your use case.
One of the popular source code repositories within corporations is SubVersion, and the canonical reference for that is the SubVersion Red Book.
A very popular source code repository for open source software is Git. For that you might want to look at the Git Community Book.
Note that even though I have said that SVN is popular in corporations and Git is popular in open source projects, neither is an absolute. There are plenty of other repository managers which can be used in either case, and SVN is still in use in open source projects, and Git is also making (slow) inroads into distributed corporate environments.