Заметки Дмитрия Пилюгина о Microsoft SQL Server 

Twitter RSS
Home Тестовые БД

Тестовые БД

БД opt

OPT — простая синтетическая БД состоящая из трех таблиц  t1, t2, t3 — 1000 строк каждая и часто используемая в этом блоге для демонстрации различного поведения сервера.
Script opt:

use master;
go
if db_id('opt') is not null drop database opt;
go
create database opt;
go
use opt;
go
create table t1(a int not null, b int not null, c int check (c between 1 and 50), constraint pk_a primary key(a));
create table t2(b int not null, c int, d char(10), constraint pk_b primary key(b));
create table t3(c int not null, constraint pk_c primary key(c));
go
insert into t1(a,b,c) select number, number%100+1, number%50+1 from master..spt_values where type = 'p' and number between 1 and 1000;
insert into t2(b,c) select number, number%100+1 from master..spt_values where type = 'p' and number between 1 and 1000;
insert into t3(c) select number from master..spt_values where type = 'p' and number between 1 and 1000;
go
alter table t1 add constraint fk_t2_b foreign key (b) references t2(b);
go
create statistics s_b on t1(b);
create statistics s_c on t1(c);
create statistics s_c on t2(c);
create statistics s_d on t2(c);
go

Adventure Works 2012-2016CTP

БД Adventure Works используется Microsoft для примеров в воображаемой компании Adventure Works Cycles. Adventure Works Cycles это воображаемая многонациональная производственная компания. Компания производит металлические и составные части для велосипедов для рынков Северной Америки,  Европы и Азии.

Adventure Works 2012
Adventure Works 2014
Adventure Works 2016CTP

Описание БД Adventure Works 2008 (дает представление о схеме и характере данных):
AdventureWorks Sample Databases (MSDN)

WideWorldImporters: Новая БД Microsoft используемая для примеров

New Microsoft Sample DB — WideWorldImporters.