Rule #2: Have a tested Backup and Recovery Plan I’m sure no one out there isn’t doing a backup on their database server at some interval compatible with the nature of their data. If you’re updating your data weekly, weekly is fine; if you’re updating every minute of every day, you need to backup more…
Tag: SQL
The DBA’s Rules
I don’t know if you’re a fan of NCIS, but for those of you who aren’t let me give you a little back story. Gibbs is the leader of an investigative team and he has a set of rules he teaches his team members in order to help make them better at their jobs. He…
Inter-Database Queries
I’ve had this question come up a few times now. “How do I copy data from one database to another?” It’s after getting a question like that, I explain fully qualified database object names. That’s a mouthful! Basically it’s a fancy way of saying the “full name” of a database object, like a table or…
SQL 201 – CREATE TABLE
CREATE TABLE I’ve showed you how to get data out of a table, put data in, change it, and delete it. But I haven’t showed you how to create your own table….until now. CREATE TABLE tableName ( columnName <datatype> ) This statement is pretty straightforward, you have to choose the name of the table, and…
SQL 101 – DELETE
It looks like I’m getting close to the end of my 101 series. After I show you how to remove data from tables, the last topic I plan to cover is creating tables. It’s been quite a journey, collecting all this knowledge and putting it out there for you. I had hoped to get some…
SQL 101 – TRANSACTION
As I mentioned in my previous post, before you move on to more difficult topics I need to share with you what a TRANSACTION is, and how to use them. By now I’m sure you’ve seen t-SQL on tutorials. The T stands for transactional. If you don’t know what a TRANSACTION is, that’s pretty meaningless,…
SQL 101 – INSERT
In all the previous articles I’ve written on SQL I’ve showed you how to get data out of the database. Now, we’re switching gears. I’m going to show you how to put data into the database. The command to put data into the database is INSERT. There are four main ways to use this command,…
SQL 101 – UPDATE
Previously, I showed you how to get new information into a SQL database. This time I’ll show you how to make changes to that data, once it’s in there. The basic structure of the change command is: UPDATE tableName SET columnName = ‘value’ WHERE <some test> I can’t tell you how important that WHERE clause…
Comparing Query Performance
A significant portion of your time as a database programmer or administrator will be to improve the performance of queries. While there are several benchmarks you can compare two or more queries, the actual comparision of the two queries can lean you do make false assumptions. When you run a query, data and execution plans…
Duplicates
Duplicates. I honestly can’t tell you how many times the root cause of a problem has been records in a table get repeated, where there should never be duplicates. I’ve perfected my method of removing the duplicates, but when it comes time to prevent them in the future, developers scoff. Maybe it has to do…