-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.sql
35 lines (33 loc) · 1.09 KB
/
database.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
/*
Prestar atenção no nome das colunas das tabelas
*/
CREATE TABLE departamento (
Id int(11) NOT NULL AUTO_INCREMENT,
Nome varchar(60) DEFAULT NULL,
PRIMARY KEY (Id)
);
/*
Prestar atenção no nome das colunas das tabelas
*/
CREATE TABLE vendedor (
Id int(11) NOT NULL AUTO_INCREMENT,
Nome varchar(60) NOT NULL,
Email varchar(100) NOT NULL,
dtNasc datetime NOT NULL,
salarioBase double NOT NULL,
DepartamentoId int(11) NOT NULL,
PRIMARY KEY (Id),
FOREIGN KEY (DepartamentoId) REFERENCES departamento (id)
);
INSERT INTO departamento (Nome) VALUES
('Computador'),
('Eletrônicos'),
('Geek'),
('Livros');
INSERT INTO vendedor (Nome, Email, dtNasc, salarioBase, DepartamentoId) VALUES
('Bob Marley','[email protected]','1998-04-21 00:00:00',1000,1),
('Maria Silva','[email protected]','1979-12-31 00:00:00',3500,2),
('Alex Santos','[email protected]','1988-01-15 00:00:00',2200,1),
('Martha Suplicy','[email protected]','1993-11-30 00:00:00',3000,4),
('Donald Trump','[email protected]','2000-01-09 00:00:00',4000,3),
('Alex Fedder','[email protected]','1997-03-04 00:00:00',3000,2);