Which data structure they will be using and how it generates short url even for each site link with uniqueness ?
Get a unique random string for the given url and store it in the DB against the URL in the DB. Once it is in the db you just need to fetch the DB and get the original URL to decode.
Check the sample implementation here - https://trinitytuts.com/simple-url-shortener-script-using-php-mysql-2/
I want to add table to the database dynamically through code on runtime. Note: I want to add tables at any point of time.