Database Design

External Article

Physical Database Design Consideration

  • Article

There are lots of things to think about when you design a physical database. What data types should I use? What column is appropriate for the primary key? Are there particular indexes that I should use to improve performance? How should I implement data integrity rules? This list goes on and on. In this article Greg Larsen will be exploring different physical database design elements.

2012-01-24

3,644 reads

External Article

Constraints and the Test-Driven Database

  • Article

Bad data always seems to appear when, and where, one least expects it. Sam explains the great value of a defensive approach based on constraints to any team that is developing an application in which the data has to be exactly right, and where bad data could cause consequential severe financial damage. It is perhaps better seen as creating a test-driven database.

2012-01-09

2,574 reads

External Article

Yet Another SQL Strategy for Versioned Data

  • Article

There is a popular design for a database that requires a built-in audit-trail of amendments and additions, where data is never deleted, but superseded by a later version. Whilst this is conceptually simple, it has always made reporting the latest version of data complicated. Alex Kuznetsov joins the debate on the best way of doing this with an example using an indexed view and the filtered index.

2011-07-15

3,274 reads

External Article

A Tale of Identifiers

  • Article

Identifiers aren't locators, and they aren't pointers or links either. They are a logical concept in a relational database, and, unlike the more traditional methods of accessing data, don't derive from the way that data gets stored. Identifiers uniquely identify members of the set, and it should be possible to validate and verify them. Celko somehow involves watches and taxi cabs to illustrate the point.

2011-06-20

2,815 reads

Technical Article

Database Design Example: Curriculum Vitae

  • Article

I’ve explained the database design process in a series of articles that you can find here. In this tutorial, I’ll put that information to good use and design a database from the start of the process to the finish. To keep this example to a single article, I’ll not repeat the information from those previous articles, so make sure you look those over before reading this one.

2011-04-11

5,179 reads

Blogs

The Book of Redgate: We Value Teams

By

This value is something that I still hear today: our best work is done...

Troubleshooting TempDB Log Full Errors When SSMS Won’t Connect

By

Have you ever received the dreaded error from SQL Server that the TempDB log...

Accelerating AI with Confidence: Why Microsoft Purview is Key to Responsible Innovation

By

Artificial intelligence is no longer a distant concept. It is here, embedded in the...

Read the latest Blogs

Forums

Is there a way for SP to know who called it?

By water490

Hi everyone I am writing an SP where there is logic inside the SP...

Planning for tomorrow, today - database migrations

By John Martin

Comments posted to this topic are about the item Planning for tomorrow, today -...

Bottlenecks on SQL Server performance

By runarlan

We have a BI-application that connects to input tables on a SQL Server 2022...

Visit the forum

Question of the Day

The Tightly Linked View

I try to run this code on SQL Server 2022. All the objects exist in the database.

CREATE OR ALTER VIEW OrderShipping
AS
SELECT cl.CityNameID,
       cl.CityName,
       o.OrderID,
       o.Customer,
       o.OrderDate,
       o.CustomerID,
       o.cityId
 FROM dbo.CityList AS cl
 INNER JOIN dbo.[Order] AS o ON o.cityId = cl.CityNameID
GO
CREATE OR ALTER FUNCTION GetShipCityForOrder
(
    @OrderID INT
)
RETURNS VARCHAR(50)
WITH SCHEMABINDING
AS
BEGIN
    DECLARE @city VARCHAR(50);
    SELECT @city = os.CityName
    FROM dbo.OrderShipping AS os
    WHERE os.OrderID = @OrderID;
    RETURN @city;
END;
go
What is the result?

See possible answers