Base de datos de Respuestas El Padre de todos los Modelos de Datos
Inicio Haga una pregunta Mejores Prácticas Comunidades Contáctenos Modelos de Datos Búsqueda Mapa del Sitio
Welcome to my Tutorial in Beginning Data Modelling Bienvenidos a mi tutorial en Inicio Modelado de datos

INTRODUCTION : INTRODUCCIÓN:
This Tutorial is for beginners to Data Modelling. Este tutorial es para los principiantes a los datos de modelos.

Topics covered in this Tutorial include :- Temas cubiertos en este tutorial incluyen: --
  1. Creating Entities Creación de Entidades
  2. Primary Keys Claves primarias
  3. Foreign Keys Foreign keys
  4. 1-to-Many Relationships 1-a-muchos Relaciones
  5. Hierarchies Jerarquías
  6. Inheritance Herencia
  7. Reference Data Datos de referencia

I have used the Dezign Data Modelling Tool to create the Data Models in this Tutorial. He utilizado el Dezign herramienta de Modelado de datos para crear modelos de datos en este tutorial.
I chose Datanamic because it is powerful, flexible and affordable. Elegí Datanamic porque es poderoso, flexible y asequible.
Members of the Database Answers Community can purchase Dezign and benefit from a discount of 25% . Miembros de la Base de Datos de Respuestas Dezign pueden adquirir y beneficiarse de un descuento del 25%.
In order to gain the benefit of this discount, all you have to do is send me an email with your Database Answers Community ID. Con el fin de obtener el beneficio de este descuento, todo lo que tiene que hacer es enviarme un correo electrónico con su base de datos Respuestas ID.
I will then send you the order instructions. A continuación, le enviaremos la orden de instalación.

  • At the end of this Tutorial, we will have produced a Data Model, which is commonly referred as an Entity-Relationship Diagram , or 'ERD' Al final de este tutorial, se han producido un modelo de datos, que es comúnmente referido como un diagrama de Entidad-Relación, o 'División de Respuesta de Emergencia "

    I hope you find this Tutorial interesting and helpful. Espero que este tutorial interesante y útil.
    Please email me and let me know. Por favor, envíame un email y que me haga saber.

  • GETTING STARTED : PARA EMPEZAR:
    The area I have chosen for this Tutorial is a Data Model for a simple Order Processing System for Starbucks. La zona que he escogido para este tutorial es un modelo de datos para un simple sistema de procesamiento de pedidos para Starbucks.
    I have done it this way because many people are familiar with Starbucks and it provides an application that is easy to relate to. Lo he hecho así porque muchas personas están familiarizadas con Starbucks y que ofrece una aplicación que es fácil relacionarse.
  • We think about the area we are going to Model. Pensamos en la zona que vamos a Modelo.
  • We can see Customers ordering Products,(Food and Drinkg and so on). Podemos ver pedidos Clientes Productos, (Food and Drinkg y así sucesivamente).
  • My Approach has three Steps :- Mi enfoque tiene tres pasos: --
    1. Establish the Scope of the Data Model Establecer el alcance del modelo de datos
    2. Identify the 'Things of Interest' that are within the Scope, These will be called Entities . Identificar las "cosas de interés que se encuentran dentro del Ámbito de aplicación, que serán llamados Entidades.
    3. Determine the Relationships between them. Determinar las relaciones entre ellos.

    DECIDING THE SCOPE OF OUR DATA MODEL DETERMINAR EL ALCANCE DE NUESTRO MODELO DE DATOS
  • When we step inside, we see that Starbucks sells a wide range of Products, so our first task is to decide which of them should be included in our Data Model. Cuando paso el interior, vemos que Starbucks vende una amplia gama de productos, por lo que nuestra primera tarea es decidir cuál de ellos debe ser incluido en nuestro modelo de datos.
  • Right now, we are interested only in something to eat and something to drink. En este momento, sólo estamos interesados en algo para comer y algo para beber.
  • Therefore, all the mugs and other items shown in this picture on the left, are outside the Scope of our Data Model, and are not 'Things of Interest'. Por lo tanto, todas las tazas y otros elementos que se muestran en esta imagen de la izquierda, se encuentran fuera del alcance de nuestro modelo de datos, y no son "cosas de interés».
  • Una de las 270 tiendas de café Starbucks en la Ciudad de Nueva York en 2007
    Modelo de datos la versión 1
    1) CREATING ENTITIES 1) CREACIÓN DE ENTIDADES
    1) Creating an Entity in Dezign 1) Creación de una Entidad en Dezign
    1. 1. Right-click on a blank area in the diagram Haga clic derecho en un área en blanco en el diagrama
    2. 2. From the drop-down list, choose Insert and Entity De la lista desplegable, seleccione Insertar y la Entidad
    3. 3. Check the 'PK' box for the Primary Key attribute, which will usually be the first one on the Entity. Compruebe el "PK" cuadro clave principal para el atributo, que normalmente será la primera en la Entidad.
    4. 4. Click on Close to save the results. Haga clic en Cerrar para guardar los resultados.
    2) PRIMARY KEYS : 2) las claves principales:
    1. At this Stage, we show only the Entities with no Relationships and minimum Attributes. and specify only the Primary Key and one 'details' field that will be replaced later on.. En esta fase, se muestran sólo las Entidades sin relaciones y atributos mínimos. Y especifique sólo la clave principal y un "detalles" sobre el terreno que será reemplazado más adelante ..
    2. The Primary Key field(s) should always be first. La clave principal de campo (s) debe ser siempre primero.
    3. You will notice that the first field in the Customers_version2 Table is the Customer_id. Usted notará que el primer campo en el cuadro es el Customers_version2 customer_id.
    4. It has a 'PK' symbol beside it, which indicates that it is the Primary Key for the Table. Tiene un "PK" símbolo al lado de él, lo que indica que es la clave principal para la tabla.
    5. The Primary Key is very important and is the way that we can recognise each individual record in the Table. La clave principal es muy importante y es la forma en que podemos reconocer cada uno de los registros en la tabla.
    Creating a Primary Key in Dezign Creación de una clave principal en Dezign
    1. 1. Right-click on the Entity Haga clic derecho en la Entidad
    2. 2. Choose Attributes Seleccione Atributos
    3. 3. Check the 'PK' box for the Primary Key attribute, which will usually be the first one on the Entity. Compruebe el "PK" cuadro clave principal para el atributo, que normalmente será la primera en la Entidad.
    4. 4. Click on Close to save the results. Haga clic en Cerrar para guardar los resultados.
    Modelo de datos la versión 2
    Modelo de datos la versión 3
    3) FOREIGN KEYS : 3) LLAVES EXTERIOR:
  • Here we have added the Relationships between the Entities . Aquí hemos añadido las relaciones entre las Entidades.
    1. When this Primary Key is used in another Table, it is referred to as a'Foreign Key'. Cuando esta clave principal se utiliza en otra tabla, se denomina clave a'Foreign ».
    2. We can see a good example in this diagram, where the customer_id appears in the Customers_Payment_Methods Table as a Foreign Key. Podemos ver un buen ejemplo en este diagrama, donde el customer_id Customers_Payment_Methods aparece en el cuadro como una clave foránea.
    3. This is shown with an 'FK' symbol beside it Esto se muestra con un 'FK' símbolo al lado de él

  • Mandatory Key Fields Principales campos obligatorios
    1. A Foreign Key is usually mandatory , in other words, a value for a customer_id in the Customers_Payment_Methods Table must correspond to an actual value of the customer_id in the Customers_Version_1 Table. Una clave externa es generalmente obligatoria, en otras palabras, un valor para un customer_id Customers_Payment_Methods en el cuadro deben corresponder a un valor real de la customer_id Customers_Version_1 en el cuadro.
    2. This is shown in the diagram by the short straight line at the end of the dotted line close to the Customers Table. Esto se muestra en el diagrama de la línea recta corta al final de la línea de puntos cerca de la tabla Clientes.
    Foreign Keys in Dezign Foreign keys en Dezign
    1. 1. Foreign Keys are created automatically when you make a Relationship between two Entities. Teclas de Relaciones Exteriores se crean automáticamente cuando se hace una relación entre dos entidades.
    2. 2. I recommend that you move the field up in the Entity so that it takes it place alphabetically among the Key fields. Recomiendo que se mueve en el ámbito de la Entidad para que se lo toma lugar en orden alfabético de los principales campos.
    To do this, right-click on the Entity choose the Attributes option, then click on the up or down arrow on the right-hand side. Para ello, haga clic derecho en la Entidad de elegir la opción Atributos y, a continuación, haga clic en la flecha arriba o abajo sobre el lado derecho.
  • 4) ONE-TO-MANY RELATIONSHIPS : 4) de uno a muchos RELACIONES:
  • One-to-Many Relationships One-to-Many Relaciones
    1. A Customer can have more than one Payment_Method, for example, American Express or Cash. Un cliente puede tener más de un Payment_Method, por ejemplo, American Express o en efectivo.
    2. In other words, we would say that the Relationship is optional at the Customers_Payment_Methods Table end. En otras palabras, diríamos que la relación es opcional en el cuadro final Customers_Payment_Methods.
    3. This is shown by the symbol that has three small lines at that end of the Relationship dotted line, which is referred to as Crow's Feet . Esto se muestra por el símbolo que tiene tres líneas pequeñas que en la Relación final de línea de puntos, que se conoce como patas de gallo.

  • Optional Key Fields Campos opcionales clave
    1. Not every Customer will have a Payment_Method. No todos los clientes tendrán un Payment_Method. In general, they would but we need to allow for situations where Customers change their minds and don't buy anything. En general, sino que tenemos que permitir situaciones en las que los clientes cambien de opinión y no compran nada.
    2. In other words, we would say that the Relationship is optional at the Customers_Payment_Methods Table end. En otras palabras, diríamos que la relación es opcional en el cuadro final Customers_Payment_Methods.
    3. This is shown by the little 'O' at that end of the Relationship dotted line. Esto se muestra por el poco "O" en ese final de la Relación con línea punteada.
  • Modelo de datos la versión 4
    Productos
    5) HIERARCHIES : 5) jerarquías:
    At this Stage, we add Reference Data. En esta fase, le añadimos los datos de referencia.
  • This diagram shows how the hierarchies of Products and Product Types that we have just discussed are shown in our Entity-Relationship Diagram . Este diagrama muestra cómo la jerarquía de productos y tipos de productos que hemos discutido se muestran en nuestra Entidad-Relación con Diagrama.


  • Rabbits Ears Conejos Orejas
  • You will notice that the table called 'Product_Types_v1' has a dotted line coming out on the right-hand side and going back in again on the top-right corner. Usted notará que el cuadro llamado "Product_Types_v1 'tiene una línea punteada que sale en el lado derecho y volver de nuevo en la esquina superior derecha.
  • Data Analysts call this a Reflexive Relationship, or informally, simply 'Rabbits Ears'. Analistas de datos llamar a esta una relación reflexiva, o informal, simplemente «Conejos Orejas".
  • In plain English, we would say that the Table is joined to itself and it means that a record in this Table can be related to another record in the Table. En la llanura Inglés, diríamos que el cuadro está unido a sí mismo y esto significa que un registro en este cuadro puede estar relacionado con otro registro en la tabla.
  • This approach is how we handle the situation where each Product can be in a hierarchy and related to another Product. Este enfoque es cómo manejar la situación en la que cada producto puede estar en una jerarquía y en relación con otro producto.
  • For example, a Product called Panini could be in a Product Sub-Category called 'Miscelleneous Sandwiches' which could be a higher Product Category called 'Cold Food', which itself could be in a higher Product Super-Category called simply 'Food'. Por ejemplo, un producto llamado Panini podría estar en una sub-categoría de productos denominada «Miscelleneous Sandwiches", que podría ser una mayor Categoría del producto denominado «el frío de la comida", que a su vez podría ser superior en un producto llamado Super-Categoría simplemente "Alimentos".
  • Next time you go into Starbucks, take a look at the borad behind the counter and try to decide how you design the Products area of the Data Model. La próxima vez que vayas a Starbucks, echa un vistazo a la borad detrás del mostrador y tratar de decidir cómo se diseñan los productos de la zona modelo de datos.
  • You should pay special attention to the little 'zeros' at each end of the dotted line. Usted debe prestar especial atención a la pequeña 'ceros' en cada extremo de la línea de puntos.
  • These are how we implement the fact that the 'Parent Product Type Code' is optional, because the highest level will not have a Parent. Se trata de cómo poner en práctica el hecho de que el "Padre del Código Tipo de producto 'es opcional, ya que el más alto nivel no tendrá un padre.
  • 6) INHERITANCE : 6) HERENCIA:
  • Food and Drink are specific examples of the more general Thing called a Product. Alimentos y bebidas son ejemplos concretos de la más general de una cosa llamada Producto.
  • They inherit some common attributes from the Product, and also have some of their own. Ellos heredarán algunos de los atributos comunes de productos, y también algunos de los suyos propios.
  • For example, Food can contain Nuts but Drink do not contain nuts, but both have a Product Name. Por ejemplo, la alimentación puede contener frutos secos, pero bebidas no contienen frutos secos, pero ambos tienen un nombre de producto.


  • The unusual symbol in the middle of the diagram, composed of a circle with two small lines underneath it is how Inheritance is shown using the particular Data Modelling Tool that I am using,which is called Dezign. El símbolo inusual en el centro del diagrama, compuesto por un círculo con dos líneas por debajo de ella es cómo la herencia se muestra usando la herramienta de Modelado de datos particular, que estoy usando, que se llama Dezign.
  • Inheritance is a very important topic when you are creating a Data Model. La herencia es un tema muy importante cuando usted está creando un modelo de datos.
  • In plain English, we would say that Inheritance occurs where a Parent-Child relationship exists between Things of Interest (or Entities). En la llanura Inglés, diríamos que la herencia se produce cuando una relación padre-hijo existente entre las cosas de interés (o entidades).
  • You can ask the simple 'Is-a' question - in this case, if we ask 'Is a Book a Product' then clearly the answer is 'Yes' so we think there is an Inheritance relationship between them. Usted puede pedir a la simple "-es una" cuestión - en este caso, si preguntamos "¿Es un libro un producto" claramente la respuesta es "Sí", así que piensa que hay una relación entre ellos la herencia.
  • In the example of Inheritance shown in this diagram, we can see that all Products have Names and Descriptions. En el ejemplo de la herencia se muestra en este diagrama, podemos ver que todos los productos tienen nombres y descripciones. Therefore, Books, Food and Drink will inherit these characteristics from the parent Product. Por lo tanto, libros, alimentos y bebidas heredarán estas características de la matriz de productos.
  • However, each type of Product will have specific characteristics that it does not share with other types of Products. Sin embargo, cada tipo de producto tiene características específicas que no comparte con otros tipos de productos. For example, Books have ISBNs and Authors, but Food and Drink do not. Por ejemplo, han ISBN Libros y Autores, la alimentación y la bebida, pero no lo hacen.
  • One of the important things in your Data Model is to be sure you have identified all the Inheritance relationships. Una de las cosas importantes en su modelo de datos es para asegurarse de que han identificado todas las relaciones de herencia.
  • However, from many years of experince as a DBA, I should point out that relationship is often blurred in a real physical Database because it can be clumsy to implement. Sin embargo, desde muchos años de experince como DBA, quiero señalar que la relación es a menudo borrosa en una verdadera base de datos físicos, ya que puede ser torpe de poner en práctica.
  • I sometimes find myself showing Inheritance in a Logical Data Model which then disappears when I design the Physical Database, which is what ultimately becomes the Database. A veces me encuentro a mí mismo que muestra la herencia en un modelo lógico de datos que luego desaparece cuando el diseño físico de bases de datos, que es lo que en última instancia se convierte en la base de datos.
  • Productos (versión 2) que muestran la herencia
    7) REFERENCE DATA : 7) DATOS DE REFERENCIA:
    • This diagram shows Address Types, which are an example of Reference Data. Este diagrama muestra los tipos de direcciones, que son un ejemplo de referencia de datos.
    • This kind of data has the following characteristics :- Este tipo de datos tiene las siguientes características: --
      1. it doesn't change very much no cambia mucho
      2. it has a relatively small number of values, usually less than a few dozen and never more than a few hundred. tiene un número relativamente pequeño de valores, por lo general menos de unas pocas docenas y nunca más de unos pocos cientos.
      3. Therefore we can show it with a Code as a Primary Key. Por lo tanto, puede mostrar con un código como clave principal.
      4. Data in Reference Data Tables can be used to populate drop-down lists for Users to select from. Los datos en los cuadros de referencia de datos pueden ser utilizados para rellenar las listas desplegables para los usuarios a seleccionar.
      5. In this way, it is used to ensure that all new data is valid. De esta manera, se utiliza para garantizar que todos los nuevos datos es válido.
    • Standards Normas
      • In the Address Table, you will see a field called 'iso_country_codes'. En la Tabla de direcciones, verá un campo llamado "iso_country_codes».
      • iso stands for the 'International Standards Organisation'. iso significa la «Organización Internacional de Normalización».
      • Where possible, it's always good to use national or international standards. Cuando sea posible, siempre es bueno utilizar las normas nacionales o internacionales.

        Customer Addresses Direcciones de clientes
      • This is a general and flexible approach to handling Addresses in our Data Model. Se trata de un enfoque general y flexible para el manejo de direcciones en nuestro modelo de datos.
      • We have a separate Address Table, which allows us to have more than one Address for any Customer very easily. Tenemos una tabla de direcciones, lo que nos permite tener más de una Dirección para cualquier cliente muy fácilmente.
      • This design also has some other benefits :- Este diseño también tiene algunas otras ventajas: --
        1. We can accomodate more than one person at the same Address. We need to do this because different members of a family may sign-up separately with Amazon. Podemos acomodar más de una persona en la misma dirección. Tenemos que hacer esto porque los diferentes miembros de una familia puede inscribirse por separado con Amazon.
        2. With a separate table of Addresses, we can easily use commercial software to validate our Addresses. To find this kind of software, simply Google for "Address Validation Software". I have used QAS with great success in the past. With this approach, we can always be sure that we have 100% good Address data in our Database. Con una tabla de direcciones, se puede utilizar fácilmente el software comercial para validar nuestras direcciones. Para encontrar este tipo de software, basta con Google para "Dirección de validación de software". QAS he utilizado con gran éxito en el pasado. Con este enfoque, siempre puede estar seguro de que tenemos 100% buena dirección en nuestra base de datos de datos.
    Amazonas Clientes - Versión 2
    De nivel superior para el modelo de datos Tutorial
    8) TOPICS IN THIS TUTORIAL : 8) TEMAS En este tutorial:
      During this short Tutorial,we have covered the following Topics :- Durante este breve tutorial, hemos cubierto los siguientes temas: --
      1. Creating Entities Creación de Entidades
      2. Primary Keys Claves primarias
      3. Foreign Keys Foreign keys
      4. 1-to-Many Relationships 1-a-muchos Relaciones
      5. Hierarchies Jerarquías
      6. Inheritance Herencia
      7. Reference Data Datos de referencia
  • If you would like to see other Topics included, please let me know . Si desea ver otros temas incluidos, por favor, hágamelo saber. Tutorial. Tutorial.

  • 9) PLEASE EMAIL ME 9) PLEASE EMAIL ME
  • I hope you have found this Tutorial interesting and useful. Espero que hayas encontrado este Tutorial interesante y útil.
  • Please email me with your questions or suggestions so I can improve this first draft Tutorial. Por favor envíeme un email con sus preguntas o sugerencias para poder mejorar el primer proyecto de este tutorial.

  • If you want to try the Dezign Data Modelling Tool , you can download it from the Datanamic Web Site . Si desea probar la Dezign Herramienta de Modelado de datos, puede descargarlo desde el sitio Web Datanamic.

    Good luck with creating your first Data Model ! Buena suerte con la creación de su primer modelo de datos!

    Barry Williams Barry Williams
    Principal Consultant Consultor Principal
    Database Answers Ltd. Base de Datos de Respuestas Ltd.
    London, England Londres, Inglaterra


  • Inicio Haga una pregunta Mejores Prácticas Comunidades Contáctenos Modelos de Datos Búsqueda Mapa del Sitio

    © DatabaseAnswers.org 2008 © 2008 DatabaseAnswers.org