In my systems I have a “pagename” field in the database. This way I can skip off the ID, and the entity if you have more than one type (e.g. article, product etc.), in the URL. The pagename would store the unique part of the URL e.g. ‘rising-gas-prices-stall-recover’.
In your logic you would have to check for uniqueness of the pagenames across your entities, and you may consider setting up some kind of pagename forwarding.
@nihcer - www.yoursite.com?articleid=123 is not an search engine friendly URL. That is the basic url with a variable that most content management systems make if you don’t turn on URL rewrite to make the URLs search engine friendly. These days Google/Bing/etc can read most types of URL structure, but it is generally better to have the article keywords/title in the URL for both SEO and actual people.
@DoubleDee - The common relationship between your article and filenames is that the title (up to a certain length) gets converted to the filename with hyphens (-) instead of spaces (spaces should not be in filenames on the web as they can break things and confuse people and search bots). It is also common to have the content category as the preceding folder name as this is often a good keyword which is useful to have there for SEO - eg. politics, sort, music, etc.
The .html at the end is a hangover from the days of a simple page-based web that was not database driven like it is today. There was a teory that search engines prefer pages that end in .html because then it knows it is a page rather than a directory, but modern search engines are far far cleverer than that, although the .html does no harm either.