It depends on what ground you have made this work for the first company. In
most countries, the ownership of the copyright rely on the working
relationship status (employee or consultant) and on the presence or absence
of any provision about the ownership of the copyright in the contract
between you and the (first) company.
If you were a full time paid employee with full social advantages, the first
company probably owns all the legal rights to the database and copying it -
even partially - might be construed as a copyright violation. However, if
you redo it from scratch, you're probably on the safe side because what you
will remember will probably be seen as an acquired competency.
If you were working as an external consultant, you have the full legal
rights to this database unless there was an explicit mention to the contrary
in your contract. Is this is the case, then you can use it in whatever way
you want; even using an identical copy for a direct competitor. This might
look strange but it's based on the fact that usually, the laws consider that
there is no difference between a consultant and a company and when a company
develop a product for another company, the developing company retains by
default all the right unless there is a provision for the contrary in the
contract.
So, the question is, what was your exact status with the first company; an
employee or a consultant and in the second case, was there any provision
about the ownership of the copyright in the contract?
BTW, the determination of the status of beeing either an employee or a
consultant will often be very difficult to make and will depend on the local
laws and on many things like the type of contract, its duration, the access
to social advantages and the use of hardwares and softwares owned either by
you or by the company.
--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Blog/web site:
http://coding-paparazzi.sylvainlafontaine.com
Independent consultant and remote programming for Access and SQL-Server
(French)