Now that we’ve built relationships between our tables, we want to take the next step with our design is making sure the data stored in our tables is as clean as possible. The tool you’ll use for this insurance, is called a constraint. The good news is you’ve already learned one type of constraint.You’ve established…
Category: Microsoft SQL
SQL 103 – Relating Your Tables
Last time we were discussing how to build normalized tables. We designed 3 tables: Customer, Address and PhoneNumber. The Address and PhoneNumber tables are related to the Customer table, but how do we relate two tables? Primary Keys When we talk about relating one table to another, we’re really talking about relating a row…
SQL 103 – Normalized Table Design
So last time we were discussing the difference between normalized and de-normalized database design. We also discussed our case study, the CRM company. We decided to begin our database design by designing normalized tables to track customers and contacts with those customers. Let’s continue with that case today. We want to build tables to store…
SQL 103 – Introduction to Database Design and Architecture
I’m starting a new blog series to accompany the session I’m presenting at SQL Saturday #87 in Louisville! This session will cover the basics of designing a database from a developer’s point of view. During the class I’ll only have an hour, but in these blog posts I’ll be able to dig in a bit…
SQL103 – Normalized or Denormalized Design
When you begin designing a database, you start with the tables. You can’t very well start with views or stored procedures, right? What tables would they reference? When you begin designing tables, one of the first calls you’ll have to make is are you going to build a set of normalized tables or denormalized tables?…
SQL201 – Stored Procedure Results
I’m working my way through the last of the 201 lessons. Today we’re going to dive back into stored procedures. This time I want to cover the three ways you can get data back out. You can simply use a SELECT statement to return a record set, or you can define one or more of…
SQL201-On Handling Errors
Let’s get back into SQL 200 by learning to deal with errors. Churchill had a great quote that applies to development (database or not) “He who fails to plan is planning to fail.” No matter how well you think you’ve planned your code, it’s going tofail. The question is, will it fail gracefully,…
Why I Went with SQL Sentry
In my SQL Saturday #80 Session I spoke about how to get started as a DBA. One of the greatest advantages you can have as a DBA is setting up a fully featured monitoring solution. I mentioned three different solutions: Redgate Monitor, Confio Ignite, and SQL Sentry Power Suite. I mentioned the pros and cons…
SQL201–The OUTPUT Clause
Starting with SQL 2005 SQL introduced a new clause for your INSERT, UPDATE, DELETE, and MERGE statements…the OUTPUT clause. If you’re not using it yet, it might be because you’re not sure what you could use it for. Let’s go through a scenario where the OUTPUT clause could save you from doing a RBAR (Row…
SQL 201-Table Variables
It’s been a while since I’ve added to my SQL 201 series, so I thought I’d pick up with table variables. In an earlier post, I covered temp tables. Temp tables are a great place to dump in raw data, then transform it into another form so you can use it in a different way. …