Advertisement
hoscanoa

Untitled

Oct 21st, 2013
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.63 KB | None | 0 0
  1. create database bd_textil
  2.  
  3. on
  4. (
  5. name='bd_textil_data',
  6. filename='c:\cibertec\data\bd_textil_Data.mdf',
  7. size=50mb,
  8. maxsize=200mb,
  9. filegrowth=10mb
  10. )
  11. ,
  12. (
  13. name='bd_textil_sec_001',
  14. filename='c:\cibertec\data\bd_textil_sec_001.ndf',
  15. size=20mb,
  16. maxsize=80mb,
  17. filegrowth=20%
  18. )
  19. log on
  20. (
  21. name='bd_textil_log',
  22. filename='c:\cibertec\data\bd_textil_log.ldf',
  23. size=40mb,
  24. maxsize=100mb,
  25. filegrowth=15mb
  26. )
  27. go
  28. use bd_textil
  29. create table cliente(
  30. cod_cli varchar(20)primary key,
  31. apepat_cli varchar(15),
  32. apemat_cli varchar(10),
  33. nom_cli varchar(15),
  34. dir_cli varchar(20),
  35. email_cli varchar(25),
  36. tel_cli int,
  37. cel_cli int
  38.  
  39. )
  40. go
  41. create table detallefactu(
  42. cod_fac varchar(20),
  43. cod_pren varchar(15),
  44. cant_ven int
  45. primary key(cod_fac,cod_pren)
  46. )
  47. go
  48. create table detalleprendas(
  49. cod_pren varchar(15),
  50. cod_mat varchar(9),
  51. cant_mat int,
  52. primary key(cod_pren,cod_mat)
  53. )
  54. go
  55. create table materiales(
  56. cod_mat varchar(9)primary key,
  57. desc_mat money,
  58. tipo_mat varchar(20),
  59. fecado_mat varchar(15),
  60. unid_med_mat varchar(8),
  61. )
  62. go
  63. create table prendas(
  64. cod_pren varchar(15)primary key,
  65. desc_pren money,
  66. pre_prenda money,
  67. stock_pren int
  68. )
  69. go
  70. create table factur(
  71. cod_fac varchar(20)primary key,
  72. fe_fac date,
  73. cod_ven varchar(20),
  74. cod_cli varchar(20)
  75. )
  76. go
  77. alter table factur
  78.  
  79. add foreign key(cod_cli)
  80. references cliente
  81.  
  82. go
  83.  
  84. alter table detallefactu
  85. add foreign key(cod_fac)references factur
  86.  
  87. go
  88. alter table detallefactu
  89. add foreign key(cod_pren)references prendas
  90.  
  91. go
  92. alter table detalleprendas
  93. add foreign key(cod_pren)references prendas
  94.  
  95. go
  96. alter table detalleprendas
  97. add foreign key(cod_mat)references materiales
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement