Создание простых запросов в базе данных. Создание структуры распределенной БД, страница 2

Construct_object

АТРИБУТ

ТИП ДАННЫХ

PKEY

FKEY

NOT_NULL

UNIQUE

Construct_object

INTEGER

*

Number_room

INTEGER

Fours

INTEGER

Plans

NVARCHAR(50)

*

Material

NVARCHAR(50)

*

Smeta

АТРИБУТ

ТИП ДАННЫХ

PKEY

FKEY

NOT_NULL

UNIQUE

ID_Smeta

INTEGER

*

Graph

INTEGER

Srok

INTEGER

CREATE TABLE Organization

(

ID_Organization int PRIMARY KEY,

Name VARCHAR(20) NOT NULL

)

CREATE TABLE Customer

(

ID_Customer int PRIMARY KEY,

Sername nvarchar(50)

)

CREATE TABLE Type_Customer

(

ID_Type_Customer int PRIMARY KEY,

)

CREATE TABLE Staff

(

ID_Staff int PRIMARY KEY,

)

CREATE TABLE Dannue

(

ID_Dannue int PRIMARY KEY,

Name_Staff nvarchar(50)NOT NULL,

)

CREATE TABLE Worker_Person

(

ID_Worker int PRIMARY KEY,

Dolgnost_Work nvarchar(50)

)

CREATE TABLE Ingeners_Person

(

ID_Ingeners int PRIMARY KEY,

Dolgnost_Ing nvarchar(50)

)

CREATE TABLE Construct_object

(

Construct_object int PRIMARY KEY,

Number_room int,

Fours int,

Plans nvarchar(50)NOT NULL,

Material nvarchar(50)NOT NULL

)

CREATE TABLE Smeta

(

ID_Smeta int PRIMARY KEY,

Graph int,

Srok int

)

INSERT INTO Dannue VALUES (031,'Евгений Сниховский')

INSERT INTO Dannue VALUES (032,'Николай Осипов')

INSERT INTO Dannue VALUES (033,'Дмитрий Ярошнко')

INSERT INTO Dannue VALUES (034,'Александра Андрюшайте')

INSERT INTO Dannue VALUES (035,'Андрей Торжков')

INSERT INTO Worker_Person VALUES (036,'Маляр')

INSERT INTO Worker_Person VALUES (037,'Мастер')

INSERT INTO Worker_Person VALUES (038,'Штукатур')

INSERT INTO Worker_Person VALUES (040,'Технолог')

INSERT INTO Worker_Person VALUES (041,'Столяр')

INSERT INTO Ingeners_Person VALUES (042,'Архитеутор')

INSERT INTO Ingeners_Person VALUES (043,'Инжинер')

INSERT INTO Ingeners_Person VALUES (044,'Начальник участка')

INSERT INTO Ingeners_Person VALUES (045,'Прораб')

INSERT INTO Ingeners_Person VALUES (046,'Начальник управления')

INSERT INTO Construct_object VALUES (047, 13,3 ,'стандартная','бетон')

INSERT INTO Construct_object VALUES (048,10,2 ,'европейская' ,'кирпич')

INSERT INTO Construct_object VALUES (049,5, 2 ,'стандартная','дерево')

INSERT INTO Construct_object VALUES (050,20,5 ,'стандартная','бетон')

INSERT INTO Construct_object VALUES (051,5,1 ,'стандартная' ,'желлезо')

INSERT INTO Smeta VALUES (052,4,18)

INSERT INTO Smeta VALUES (053,7,12 )

INSERT INTO Smeta VALUES (054,20,14)

INSERT INTO Smeta VALUES (055,30,36)

INSERT INTO Smeta VALUES (056,7,9)

SELECT *FROM Organization

SELECT *FROM Customer

SELECT *FROM Type_Customer

SELECT *FROM Staff

SELECT *FROM Dannue

SELECT *FROM Worker_Person

SELECT *FROM Ingeners_Person

SELECT *FROM Construct_object

SELECT *FROM Smeta

 DROP TABLE Organization

 Go

 DROP TABLE Customer

 Go

 DROP TABLE Staff

 Go

 DROP TABLE Construct_object

 Go

 DROP TABLE Type_Customer

 Go

 DROP TABLE Dannue

 Go

 DROP TABLE Worker_Person

 Go

 DROP TABLE Ingeners_Person

 Go

 DROP TABLE Smeta

 Go

 ALTER TABLE Customer ADD Type_Customer nvarchar(50);

   

 

ALTER TABLE Controls ADD Kontrol_form nvarchar(50);