Intro to SQL Part A
I like to think of myself as a practical web developer. With no true formal training, most of what I use to make my web sites is self-taught. Instead of trying to apply what I learned in a classroom into an online project, I went out and learned what I needed to get a project done. This allowed me to enter the world of web programming slowly, gradually picking up additional techniques and languages as my web sites became more advanced. There has been more than once that this approach has made my life difficult, though, and SQL is one of the more blatant examples.
After I learned xHTML and CSS, I thought that I was set with web development. I could design and launch fully compliant sites, updating them as necessary with new content. Once a few months passed, though, I started to realize that there was a big difference between markup and content, and that the content (data) of a web site should be handled separately from the markup (html tags). By keeping my changing content hard-coded on the page, I was losing my old data and funneling all of the updates through a single person, myself, who knew how to write markup.
I started looking at alternate methods of saving my dynamic content over the next year, using both xml and text files to save the data. With a static process to create and layout the data, I could write PHP scripts to parse out my information and display it on the web site in a simple, looping way that created clean markup. This also allowed other people to add content without knowing HTML, which spread out the content generation for my sites. These solutions became unwieldy on larger sites , since handling complex data is difficult with simple data storage. It wasn't until my first full time job that I realized what SQL was and just how much I was missing from my web development process.
My single class in web development taught me a very important rule... Keep design and content separate. For data heavy sites, it's important to extend this another level... Keep design, markup, and content separate. Font styles, colors, sizes, etc should be limited to a CSS style sheet to keep users interested with your web site. In the same way, HTML tags and structure should be kept separate from your raw data, as their main purpose is to present and hold content for the end user. Content is simply the data for your site. While it's displayed within the structure of HTML, it should be handled outside of the HTML markup. This will make changes easier and the reuse of content for different pages, like RSS feeds or page summaries, simple.
SQL offers many excellent features for data handling that made my primitive XML and text files look like child's play. The ability to loop, join, and filter content within a single statement gave me amazing power over my content with different projects. While it took me a while to fully grasp the difference between static content in a separate file and a database, once I understood SQL, the rest of the features were very easy to learn.
In my next post, I'll explain more about SQL and some of its basic concepts and usages. Stay tuned!
Comments (0)