I think it will be faster, but if its a better database design and structure I'm not sure,
Should I create a field in
Users table which indicates if the user has a shopping cart or not, and only if its TRUE - 1 than to search for his
OrderID in the
ShoppingCart table ?
Or just to search anyway for
UserID when the user is logging in ?
[Users] ( UserID INT IDENTITY(1,1) PRIMARY KEY, EmailAddress NVARCHAR(320) UNIQUE, PasswordHash VARCHAR(32), FirstName VARCHAR(256) NOT NULL, LastName VARCHAR(256) NOT NULL, HasCart BIT DEFAULT 0 ) [ShoppingCart] ( OrderID INT PRIMARY KEY IDENTITY(1,1), UserID INT FOREIGN KEY REFERENCES [Users](UserID), CreatedDate DATETIME DEFAULT(GETDATE()) )