-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDL_Sent.sql
56 lines (41 loc) · 901 Bytes
/
DDL_Sent.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
-------------------------Sentencias DDL -----------------------
CREATE SCHEMA DeliPizza;
GO
CREATE DATABASE DeliPizza;
GO
USE DeliPizza;
GO
CREATE TABLE Productos (
id int IDENTITY(1,1) not null,
tipo varchar(30) NOT NULL,
nombre varchar(50) NOT NULL,
precio decimal NOT NULL,
PRIMARY KEY (id)
);
GO
CREATE TABLE Clientes (
Id int IDENTITY(1,1) NOT Null,
Nombre varchar(50) NOT NULL,
Apellido varchar(50) NOT NULL,
Direccion varchar(255),
PRIMARY KEY (Id)
);
GO
CREATE TABLE Descuentos(
id int IDENTITY(1,1) NOT NULL,
descuento int NOT NULL,
PRIMARY KEY (id),
)
GO
CREATE TABLE Compras (
id int IDENTITY(1,1) NOT NULL,
cliente int ,
producto int NOT NULL,
descuento int,
PRIMARY KEY(id),
FOREIGN KEY(cliente) REFERENCES Clientes(id),
FOREIGN KEY(producto) REFERENCES Productos(id),
FOREIGN KEY(descuento) REFERENCES Descuentos (id)
);
GO
EXEC sp_help Compras