SQL For Developers – 9 Reasons to bother

F03I0081 If you are a developer like I am, you’ve probably gotten by with pretty simple SQL for quite a while. In fact, my experience has been that developers don’t get much past SELECT, INSERT, UPDATE, and DELETE with the associated WHERE and ORDER BY clauses that are necessary to get anything done as a developer.

But there are times when knowing more would be helpful. So today, I thought I’d start a short series on helpful SQL for developers. Keep in mind, I’m a developer, not a DBA. I’m sure there may be better ways of doing some of the things I suggest. However, everything I suggest will be better than trying to do it all from your CSharp or VB.NET code.

Let’s look at some of the reasons a developer should learn SQL:

  • If you only use the statements above, your code is almost certainly making more trips to the database than it should, or needs to. Simply put, the performance of your applications is suffering.
  • Prior to ASP.NET, and, to a lesser extent, with it, you open yourself up to the possibility of SQL injection attacks because you are only using the statements above.
  • You are probably avoiding a good three-tiered architecture because it practically requires you to write stored procedures. This is making your code harder to maintain.
  • You are probably using the SqlDataObject for your data binding. As a result, you are frustrated with the errors this is causing you in your updates that you have very limited ways of tracking down.
  • By refusing to learn the DDL portion of SQL, you are limited in how you can version your database. If you learn DDL, you’ll be able to version your database schemas in a similar manner to how you version your source code.
  • If you are writing DotNetNuke modules that access a database, you’ll need this information.
  • By learning SQL, your SQL will become less of a hack, making this part of your development effort more efficient.
  • Even if you have a DBA who is responsible for writing this code for you, wouldn’t it be helpful to be able to speak his language? I’ve been programming for 21 years now and I’ve only met one DBA who knows more than I do about SQL. Considering that I would not consider myself an expert in SQL this reflects poorly on the DBAs that I’ve had to work with. What this means in practical terms is, you are a lot more likely to get the SQL code you want into your database if you can just hand it to your DBA and say, “Do this,” rather than asking for a stored procedure that does something. Code is the best specification.
  • Having a firm grasp of SQL will make you a more valuable programmer. This is the best reason of all.

Stick with me over the next several weeks and we’ll introduce some SQL that you can use in your daily programming life.

Related Post

  • Temporary Tables – SQL For ProgrammersTemporary Tables – SQL For Programmers You may think that you don't need a temporary table.  But if you've ever retrieved data from your database or retrieved data from a table and put it in a list of some sort simply to process it fur...
  • SQL – TransactionsSQL – Transactions Ruth ask, How do I do transaction tracking within a stored procedure? Hopefully, if you’ve been programming for any length of time against databases, you know that if you are updating mult...
  • SQL For Programmers – ALTERing the TABLESQL For Programmers – ALTERing the TABLE One of the main problems we seem to be stuck with at this point in programming history is, how do we version our databases? You could put the whole database into version control, I guess.  Bu...
  • SQL For Programmers – Finding IN a ListSQL For Programmers – Finding IN a List In the last SQL post, we looked at looking for content that was LIKE other content.  While this has its uses, it is limited in its ability to find more than one pattern.  So what if we want to fin...
  • Basic SQL Commands – SQL For ProgrammersBasic SQL Commands – SQL For Programmers Before we get into the specifics of the commands that can be used within a stored procedure, I think it would be helpful to review some of the more basic commands that we can use that don't really ...