Advertisement
tutorfree

MySQL - Exercise 02

Jul 10th, 2016
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.09 KB | None | 0 0
  1. create database scel;
  2.  
  3. use scel;
  4.  
  5. create table depto(
  6.     codDepto int not null auto_increment,
  7.     nomDepto varchar(10),
  8.     primary key(codDepto)
  9.     );
  10.  
  11. insert into depto(nomDepto) values
  12.     ('Esportes'),
  13.     ('Lazer'),
  14.     ('Cultura');
  15.  
  16. create table funcionario(
  17.     regiFunc int not null,
  18.     nomeFunc varchar(30) not null,
  19.     sexoFunc CHAR(1) CHECK (SexoFunc='F' OR SexoFunc='M'),
  20.     cargFunc varchar(20),
  21.     locaFunc varchar(30),
  22.     codDepto int,
  23.     cargHora int,
  24.     horaTrab varchar(50),
  25.     regiTrab varchar(20),
  26.     observac varchar(100),
  27.     fotoFunc varchar(30),
  28.     primary key(regiFunc),
  29.     CONSTRAINT Fk_Depto FOREIGN KEY(codDepto) REFERENCES depto(codDepto)
  30.     );
  31.  
  32. insert into funcionario(regiFunc, nomeFunc, sexoFunc, cargFunc, locaFunc, codDepto, cargHora, horaTrab, regiTrab, observac, fotoFunc) values
  33. (20072, 'José Sanches', 'M', 'Agente Administrativo', 'Ginásio Pedro Stevão', 1, 40, '13:00 às 16:00 e das 17:oo às 22:00', 'CLT', '', '\imagens\20072.jpg'),
  34. (20300, 'Maria das Dores', 'F', 'Agente Administrativo', 'Gabinete', 2, 40, '8:00 às 12:00 e das 13:oo às 17:00', 'CLT', 'afastada', '\imagens\20300.jpg');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement