-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.sql
More file actions
executable file
·46 lines (38 loc) · 1.27 KB
/
sql.sql
File metadata and controls
executable file
·46 lines (38 loc) · 1.27 KB
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
-- cmd
-- cd arquivos de programas/mysql/mysql server 5.7/bin
-- mysql.exe -h localhost -u root -p
CREATE DATABASE locaweb;
USE locaweb;
-- cria as tabelas
CREATE TABLE funcionarios(
idFuncionario INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
nome VARCHAR(20) NOT NULL,
codigo INT(4) NOT NULL,
perfil CHAR(13) NOT NULL);
CREATE TABLE clientes(
idCliente INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
nome VARCHAR(20) NOT NULL,
cpf VARCHAR(14) NOT NULL,
codigo int(4) NOT NULL,
funcionarios_idFuncionario INT NOT NULL,
foreign key(funcionarios_idFuncionario) references funcionarios(idFuncionario));
CREATE TABLE catalogo(
idCatalogo INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
codigo INT(6) NOT NULL,
filme VARCHAR(60) NOT NULL,
imagen varchar(60) NOT NULL);
CREATE TABLE alugados(
idAlugado INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
cliente VARCHAR(20) NOT NULL,
codigo INT(4) NOT NULL,
filme VARCHAR(60) NOT NULL,
dtAlugado DATE NOT NULL,
hrAlugado char(5) NOT NULL,
clientes_idCliente INT NOT NULL,
catalogo_idCatalogo INT NOT NULL,
foreign key(clientes_idCliente) references clientes(idCliente),
foreign key(catalogo_idCatalogo) references catalogo(idCatalogo));
insert into funcionarios(idFuncionario,nome,codigo,perfil)
values
(null,'popo',1212,'Administrador'),
(null,'didi',1111,'Funcionario');