Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Using Database in Web Development-Part 5

Wednesday, May 14th, 2014 by Servage

b

What you are learning here is merely the tip of the proverbial iceberg. There is much more to learning about databases but this will give you a good foundation to build on. There is always more to learn and, as usual, nothing stays the same.

Database FAQs

So, what’s the deal with the semicolon? The semicolon at the end of a statement simply tells the DBMS that you are done with that statement and it should process it now. DBMSs can very greatly when it comes to designating the end of a statement so be sure to check your DBMS and see which one is right for you.

Isn’t there a better way to enter some data? Better is relative. The INSERT and UPDATE statements that you learned above along with many others will be necessary when you begin coding in technologies like ASP, JSP and PHP. There are GUI interfaces for almost all DBMSs now which pretty much layout your tables in an easy to use format so that you can enter data without typing a word of SQL. These can be handy for doing some simple updates, adding test data and examining how your SQL script effects a table. Learning how to code SQL statements, however, gives you the background to fully utilize your database within whatever technology you choose.

So, what happens if I generate a SQL error? Well, most DBMSs will simply stop and not execute the statement where the error occurred. In other words, if in the example above we forgot that “last_name” had to have a value and we tried to insert a NULL the INSERT statement would do absolutely nothing. It would not go ahead and create a row with just “John” in the “first_name” column.

Should I always spell out in painful detail everything that I am doing? Yes! It may be more typing in the short term but it sure makes life easier in the long run. You may remember quite vividly how you did your code from 2 weeks ago but will you have that clarity one year from now?

Should I take advantage of shortcuts I find with my DBMS? That depends but probably not. If your DBMS has a shortcut that saves you some time typing it may be very tempting to use it. Keep in mind, though, whenever you use a shortcut that is specific to your DBMS that you may sacrifice portability. For example, you have created a database for your web based business and took advantage of some shortcuts provided with your small business DBMS that you bought. Now, three years later your business has outgrown your DBMS and you have to invest in an more robust DBMS. You begin to move your data and code over only to find that your shortcuts don’t work with the new DBMS and you have to spend days or weeks finding all of the places that you used the shortcuts and fix them.

Sources for Further Reading

Using Database in Web Development-Part 5, 3.7 out of 5 based on 3 ratings
Categories: Guides & Tutorials

Keywords:

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.