Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create database bd_textil
- on
- (
- name='bd_textil_data',
- filename='c:\cibertec\data\bd_textil_Data.mdf',
- size=50mb,
- maxsize=200mb,
- filegrowth=10mb
- )
- ,
- (
- name='bd_textil_sec_001',
- filename='c:\cibertec\data\bd_textil_sec_001.ndf',
- size=20mb,
- maxsize=80mb,
- filegrowth=20%
- )
- log on
- (
- name='bd_textil_log',
- filename='c:\cibertec\data\bd_textil_log.ldf',
- size=40mb,
- maxsize=100mb,
- filegrowth=15mb
- )
- go
- use bd_textil
- create table cliente(
- cod_cli varchar(20)primary key,
- apepat_cli varchar(15),
- apemat_cli varchar(10),
- nom_cli varchar(15),
- dir_cli varchar(20),
- email_cli varchar(25),
- tel_cli int,
- cel_cli int
- )
- go
- create table detallefactu(
- cod_fac varchar(20),
- cod_pren varchar(15),
- cant_ven int
- primary key(cod_fac,cod_pren)
- )
- go
- create table detalleprendas(
- cod_pren varchar(15),
- cod_mat varchar(9),
- cant_mat int,
- primary key(cod_pren,cod_mat)
- )
- go
- create table materiales(
- cod_mat varchar(9)primary key,
- desc_mat money,
- tipo_mat varchar(20),
- fecado_mat varchar(15),
- unid_med_mat varchar(8),
- )
- go
- create table prendas(
- cod_pren varchar(15)primary key,
- desc_pren money,
- pre_prenda money,
- stock_pren int
- )
- go
- create table factur(
- cod_fac varchar(20)primary key,
- fe_fac date,
- cod_ven varchar(20),
- cod_cli varchar(20)
- )
- go
- alter table factur
- add foreign key(cod_cli)
- references cliente
- go
- alter table detallefactu
- add foreign key(cod_fac)references factur
- go
- alter table detallefactu
- add foreign key(cod_pren)references prendas
- go
- alter table detalleprendas
- add foreign key(cod_pren)references prendas
- go
- alter table detalleprendas
- add foreign key(cod_mat)references materiales
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement