Skip to content

Commit c3e6be6

Browse files
authored
Add files via upload
Signed-off-by: Daniel Gatti <daniel@pucsp.br>
1 parent 2a87dcd commit c3e6be6

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

CreateConstraints.sql

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
USE Concessionaria;
2+
3+
CREATE TABLE tblEstoque
4+
(
5+
idEstoque int identity
6+
Constraint PK_tblEstoque_idEstoque
7+
Primary Key (idEstoque),
8+
9+
idModelo int not null
10+
Constraint FK_tblEstoque_tblModelos
11+
Foreign Key (idModelo)
12+
References tblModelos(idModelo),
13+
14+
dataEntrada date Default GETDATE(),
15+
16+
precoEstoque money not null
17+
Constraint CK_tblEstoque_precoEstoque
18+
CHECK (precoEstoque >= 10000 AND precoEstoque <= 200000)
19+
20+
);
21+
22+
-- Nova Coluna
23+
ALTER TABLE tblEstoque
24+
ADD placa nChar(8) not null;
25+
26+
27+
-- Alterar o tamanho de uma coluna
28+
ALTER TABLE tblEstoque
29+
ALTER COLUMN placa nChar(7) Null;
30+
31+
EXEC sp_help tblEstoque;
32+
33+
-- Excluir Coluna
34+
ALTER TABLE tblEstoque
35+
DROP COLUMN placa;
36+
37+

0 commit comments

Comments
 (0)