0% found this document useful (0 votes)
18 views5 pages

BD PowerShell

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

BD PowerShell

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

EMPRESA

USE [RappiBD] 

GO 

/****** Object:  Table [dbo].[Empresa]    Script Date: 6/11/2021 23:53:31 ******/ 

SET ANSI_NULLS ON 

GO 

SET QUOTED_IDENTIFIER ON 

GO 

CREATE TABLE [dbo].[Empresa]( 

[id_empresa] [int] NOT NULL, 

[nom_tienda] [varchar](100) NULL, 

[tipo_servicio] [varchar](50) NULL, 

[tipo_persona] [varchar](100) NULL, 

[num_ruc] [int] NULL, 

[tipo_regimen] [varchar](100) NULL, 

[razon_social] [varchar](100) NULL, 

[codigo_referido] [varchar](30) NULL, 

[estado_empresa] [bit] NULL, 

[id_titular] [int] NOT NULL, 

CONSTRAINT [PK_Empresa] PRIMARY KEY CLUSTERED  

[id_empresa] ASC 

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,


ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 

) ON [PRIMARY]

GO 
ALTER TABLE [dbo].[Empresa]  WITH CHECK ADD  CONSTRAINT
[FK_Empresa_CuentaEmpresa] FOREIGN KEY([id_titular]) 

REFERENCES [dbo].[CuentaEmpresa] ([id_titular]) 

GO 

ALTER TABLE [dbo].[Empresa] CHECK CONSTRAINT [FK_Empresa_CuentaEmpresa] 

GO 

CUENTA EMPRESA

CREATE TABLE [dbo].[CuentaEmpresa]( 

[id_titular] [int] NOT NULL, 

[nombre_titular] [varchar](100) NULL, 

[tipo_documento] [varchar](50) NULL, 

[num_documento] [char](12) NULL, 

[tipo_cuenta] [varchar](50) NULL, 

[num_cuenta] [varchar](50) NULL, 

[cel_num] [varchar](50) NULL, 

[domicilio_fiscal] [varchar](100) NULL, 

[telefono_titular] [int] NULL, 

[correo_titular] [varchar](50) NULL, 

[id_entidad] [int] NULL, 

CONSTRAINT [PK_CuentaEmprsa] PRIMARY KEY CLUSTERED  

[id_titular] ASC 

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,


ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
) ON [PRIMARY] 

GO 

ALTER TABLE [dbo].[CuentaEmpresa]  WITH CHECK ADD  CONSTRAINT


[FK_CuentaEmpresa_EntidadFinanciera] FOREIGN KEY([id_entidad]) 

REFERENCES [dbo].[EntidadFinanciera] ([id_entidad]) 

GO 

ALTER TABLE [dbo].[CuentaEmpresa] CHECK CONSTRAINT


[FK_CuentaEmpresa_EntidadFinanciera] 

GO 

ENTIDAD FINANCIERA

USE [RappiBD] 

GO 

/****** Object:  Table [dbo].[EntidadFinanciera]    Script Date: 6/11/2021 23:54:50 ******/ 

SET ANSI_NULLS ON 

GO 

SET QUOTED_IDENTIFIER ON 

GO 

CREATE TABLE [dbo].[EntidadFinanciera]( 

[id_entidad] [int] NOT NULL, 

[nom_entidad] [varchar](50) NULL, 

CONSTRAINT [PK_EntidadFinanciera] PRIMARY KEY CLUSTERED  

[id_entidad] ASC 

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,


ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
) ON [PRIMARY] 

GO 

Sucursal x
USE [RappiBD] 

GO 

/****** Object:  Table [dbo].[Sucursal]    Script Date: 7/11/2021 00:40:12 ******/ 

SET ANSI_NULLS ON 

GO 

  

SET QUOTED_IDENTIFIER ON 

GO 

CREATE TABLE [dbo].[Sucursal]( 

[id_sucursal] [int] NOT NULL, 

[direccion_sucursal] [varchar](50) NULL, 

[id_empresa] [int] NULL, 

CONSTRAINT [PK_Sucursal] PRIMARY KEY CLUSTERED  

[id_sucursal] ASC 

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,


ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY =
OFF) ON [PRIMARY] 
) ON [PRIMARY] 

GO 

ALTER TABLE [dbo].[Sucursal]  WITH CHECK ADD  CONSTRAINT [FK_Sucursal_Empresa]


FOREIGN KEY([id_empresa]) 

REFERENCES [dbo].[Empresa] ([id_empresa]) 

GO 

ALTER TABLE [dbo].[Sucursal] CHECK CONSTRAINT [FK_Sucursal_Empresa] 

GO 

You might also like