Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 08-04-2017
Snayder187 Snayder187 is offline
Registrado
NULL
 
Registrado: abr 2017
Posts: 3
Poder: 0
Snayder187 Va por buen camino
Consulta en SQL Server

Hola ¿qué tal amigos programadores?

Tengo una consulta, recién me estoy metiendo a temas de programación en SQL SERVER con C# y quisiera hacer un proyecto bueno y un poco grande, de paso practico más. Haré un proyecto sobre "EVENTOS" en Perú-Lima es como festival de fiestas, tengo algunas tablas en mente pero me gustaría leer sus ideas si esta bien o me falta implementar más cosas.

TABLA PERSONAL
- idpersonal
- nombres
- apellidos
- dni
- fecha de nacimiento
- dirección
- telefono
- celular
- estado civil
- estado

- TABLA PROVEEDOR
- TABLA CLIENTES
- TABLA CONTRATO
- TABLA ALQUILER
- TABLA PRECIOS
- TABLA ITEMS
- TABLA COTIZACION
- TABLA EVENTOS
- TABLA REPORTES

Que más tablas puedo hacer y que tablas debo relacionar los FK's, aparte que campos irían en las tablas, espero que me puedan ayudar.
Responder Con Cita
  #2  
Antiguo 08-04-2017
Snayder187 Snayder187 is offline
Registrado
NULL
 
Registrado: abr 2017
Posts: 3
Poder: 0
Snayder187 Va por buen camino
CREATE DATABASE EVENTOS
GO

USE EVENTOS
GO

TABLE CATEGORIA
- idcategoria int identity(1,1) primary key,
- nom_categoria varchar(100) not null


TABLE TIPO_ITEM
- idtipoitem int identity(1,1) primary key,
- idcategoria int,
- nom_tipoitem varchar(100) not null


TABLE ITEM
- iditem int identity(1,1) primary key,
- idtipoitem int not null,
- des_item varchar(100) not null, << descripcion
- con_item varchar(20) not null, << condicion
- sto_item int not null << stock


TABLE DETALLE_ITEM
- iddetalleitem int identity(1,1) primary key,
- idtipoitem int not null,
- med_detalleitem varchar(50) not null, << medidas
- cap_detalleitem int not null, << capacidad
- dir_detalleitem varchar(100) not null


TABLA PROVEEDOR
- idproveedor int identity(1,1) primary key,
- ruc_proveedor char(11) not null,
- razonsocial_proveedor varchar(100) not null,
- contacto varchar(100) not null,
- celular varchar(12) not null,
- direccion varchar(100) not null,
- telefono varchar(11) null,
- email varchar(80) null,
- estado varchar(1) not null


TABLE PERSONAL
- idpersonal int identity(1,1) primary key
- nom_personal varchar(80) not null,
- ape_personal varchar(100) not null,
- dni_personal varchar(8) not null,
- fna_personal date not null,
- dir_personal varchar(100) not null,
- tel_personal varchar(11) null,
- cel_personal varchar(13) not null,
- esc_personal varchar(25) not null,
- est_personal varchar(1) not null



TABLA PRECIOS

TABLA CONTRATO

TABLA ALQUILER

TABLA CLIENTES

TABLA COTIZACION

TABLA EVENTOS

TABLA REPORTES
Responder Con Cita
  #3  
Antiguo 08-04-2017
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.021
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Bienvenido a clubdelphi, como siempre aconsejamos a los nuevos, no olvides leer nuestra guía de estilo, gracias por tu colaboración

Y recuerda poner los tags al código fuente, ejemplo:



Gracias

También recuerda poner títulos descriptivos a tus preguntas
Responder Con Cita
  #4  
Antiguo 10-04-2017
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
El problema es que el diseño de Base de Datos no es una ciencia exacta como las matemáticas.
No hay una tabla se PERSONAL con sus campos y relaciones que sirva para todo. Dependerá de las necesidades que tenga tu programa, de lo que quieras hacer, de lo que quieras almacenar, etc, etc, etc,...

No hay una fórmula que poniendo: "proyecto sobre EVENTOS" te devuelva los campos.

Tampoco sabemos para qué sirve la tabla de CATEGORIA, por ponerte un ejemplo o qué vas a hacer con la tabla ITEM (que podría ser cualquier cosa).

Piensa el los datos necesarios a almacenar, los procesos a implementar y te irán apareciendo CAMPOS y RELACIONES.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #5  
Antiguo 10-04-2017
Snayder187 Snayder187 is offline
Registrado
NULL
 
Registrado: abr 2017
Posts: 3
Poder: 0
Snayder187 Va por buen camino
Esta es mi base de datos ya terminada...

Código SQL [-]
CREATE DATABASE EVENTOS
GO

USE EVENTOS
GO


create TABLE CATEGORIA
(
  idcategoria int identity(1,1) primary key,
  nom_categoria varchar(100) not null
)

create TABLE TIPO_ITEM
(
  idtipoitem int identity(1,1) primary key,
  idcategoria int foreign key references CATEGORIA(idcategoria),
  nom_tipoitem varchar(100) not null
)

create TABLE ITEM
(
  iditem int identity(1,1) primary key,
  idtipoitem int foreign key references TIPO_ITEM(idtipoitem),
  des_item varchar(100) not null,    
  con_item varchar(20) not null,    
  sto_item int not null        
)

create TABLE DETALLE_ITEM
(
  iddetalleitem int identity(1,1) primary key,
  idtipoitem int foreign key references TIPO_ITEM(idtipoitem),
  med_detalleitem varchar(50) not null,    
  cap_detalleitem int not null,        
  dir_detalleitem varchar(100) not null
)

create TABLE PROVEEDOR
(
  idproveedor int identity(1,1) primary key,
  ruc_proveedor char(11) not null,
  rzo_proveedor varchar(100) not null,
  con_proovedor varchar(100) not null,
  cel_proovedor varchar(12) not null,
  dir_proovedor varchar(100) not null,
  tel_proovedor varchar(11) null,
  ema_proovedor varchar(80) null,
  est_proovedor varchar(1) not null
)

create TABLE PERSONAL
(
  idpersonal int identity(1,1) primary key,
  nom_personal varchar(80) not null,
  ape_personal varchar(100) not null,
  dni_personal varchar(8) not null,
  fna_personal date not null,
  dir_personal varchar(100) not null,
  tel_personal varchar(11) null,
  cel_personal varchar(13) not null,
  esc_personal varchar(25) not null,
  ema_personal varchar(100) not null,
  car_personal varchar(30) not null,
  est_personal varchar(1) not null
)

create TABLE PRECIOS
(
  idprecio int identity(1,1) primary key,
  iditem int foreign key references ITEM(iditem),
  idproveedor int foreign key references PROVEEDOR(idproveedor),
  fec_precios date not null,
  pco_precios double(6,2) not null,    
  pve_precios double(6,2) not null,    
  uti_precios double(6,2) not null     
)

create TABLE COTIZACION
(
  idcotizacion int identity(1,1) primary key,
  sol_cotizacion varchar(150) not null,
  tel_cotizacion varchar(13) not null,
  des_cotizacion varchar(100) not null,
  inv_cotizacion varchar(8) not null,
  fec_cotizacion date not null,
  idproveedor int foreign key references PROVEEDOR(idproveedor)
)

create TABLE EVENTO
(
  idevento int identity(1,1) primary key,
  idcotizacion int foreign key references COTIZACION(idcotizacion),
  hin_evento date not null,      
  hfi_evento date not null,      
  est_evento varchar(15) not null,
  dir_evento varchar(150) not null,
  idpersonal int foreign key references PERSONAL(idpersonal),
  tev_evento varchar(70) not null,    
  fec_evento date not null
)

create TABLE MENAJE
(
idmaneja int identity(1,1) primary key,
idcotizacion int foreign key references COTIZACION(idcotizacion),
iditem int foreign key references ITEM(iditem)
)

create TABLE CLIENTE
(
  idcliente int identity(1,1) primary key,
  tip_cliente char(1) not null,      
  tdo_cliente varchar(20) not null,    
  ndo_cliente varchar(11) not null,    
  nom_cliente varchar(150) not null,
  dir_cliente varchar(150) not null,    
  tel_cliente varchar(13) not null,    
  ema_cliente varchar(100) null      
)
  
create TABLE CONTRATO
(
  idcontrato int identity(1,1) primary key,
  idcliente int foreign key references CLIENTE(idcliente),
  fec_contrato date not null,
  est_contrato varchar(50) not null,    
  idevento int foreign key references EVENTO(idevento),
  cuo_contrato int not null,    
  imp_contrato double not null,      
  ima_contrato image not null      
)

create TABLE COMPRA
(
  idcompra int identity(1,1) primary key,
  idproovedor int foreign key references PROVEEDOR(idproveedor),
  iditem int foreign key references ITEM(iditem),
  ser_compra varchar(6) not null,    
  nco_compra varchar(8) not null
)  

create TABLE ALQUILER
(
idalquiler int identity(1,1) primary key,
idproovedor int foreign key references PROVEEDOR(idproveedor),
iditem int foreign key references ITEM(iditem),
idcontrato int foreign key references CONTRATO(idcontrato)
)
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Ayuda consulta sql server victoriano MS SQL Server 1 02-03-2013 03:55:35
Consulta SQL con MS SQL Server cmfab MS SQL Server 6 28-02-2012 11:33:32
Consulta en SQL Server Jose Roman SQL 4 24-06-2008 16:02:08
Crear tabla en una BD en Server A desde consulta en tabla B en server B joaquinalberto MySQL 1 18-05-2007 11:39:27
MSSQL Server - Consulta Viet SQL 4 05-12-2003 15:45:18


La franja horaria es GMT +2. Ahora son las 01:40:10.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi