We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2a87dcd + c3e6be6 commit 563d911Copy full SHA for 563d911
1 file changed
CreateConstraints.sql
@@ -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
29
+ALTER COLUMN placa nChar(7) Null;
30
31
+EXEC sp_help tblEstoque;
32
33
+-- Excluir Coluna
34
35
+DROP COLUMN placa;
36
37
0 commit comments