Which SQL Server field type is best for storing price values?

If you’re absolutely sure your numbers will always stay within the range of smallmoney, use that and you can save a few bytes. Otherwise, I would use money. But remember, storage is cheap these days. The extra 4 bytes over 100 million records is still less than half a GB. As @marc_s points out, however, … Read more

How do we implement an IS-A Relationship?

I did as Donnie suggested, but without the role field, because it complicates things. This is the final implementation: DDL: CREATE TABLE Employee ( ast VARCHAR(20) not null, firstname VARCHAR(200) not null, surname VARCHAR(200) not null, … PRIMARY KEY(ast) ); CREATE TABLE Administrative ( employee_ast VARCHAR(20) not null REFERENCES Employee(ast), PRIMARY KEY(employee_ast) ); CREATE TABLE … Read more

Storing HTML in SQL Server

VARCHAR(MAX) if it’s all going to be ascii-based, say for basic HTML tepmplates NVARCHAR(MAX) if the HTML could contain any content NVARCHAR will double your storage use as it uses double the amount of space as VARCHAR. HTML itself does not require NVARCHAR, only the content in-between the HTML tags could based on the language, … Read more

How to design a multi tenant mysql database [closed]

There are several approaches to multi-tenant databases. For discussion, they’re usually broken into three categories. One database per tenant. Shared database, one schema per tenant. Shared database, shared schema. A tenant identifier (tenant key) associates every row with the right tenant. MSDN has a good article on the pros and cons of each design, and … Read more