<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Database design in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324947#M1030574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're right, additional checks have to be done when I create a FLIGHTID.&lt;/P&gt;&lt;P&gt;But otherwise I would have 6 key fields for ZFLIGHTS and 7 key fields for ZFLIGHTS_OPR.&lt;/P&gt;&lt;P&gt;So I prefer to use an ID in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think in terms of normalization and database design it's the better approach.&lt;/P&gt;&lt;P&gt;And for instance in SQL it's much more popular to use auto-increment IDs as table keys.&lt;/P&gt;&lt;P&gt;The bad thing in SAP is that you don't have auto-incrementation (as far as I know). You've to create a number range with an interval and have to generate the next number each time you're adding a new entry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Aug 2008 09:06:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-22T09:06:21Z</dc:date>
    <item>
      <title>Database design</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324945#M1030572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let's assume I've these database tables:&lt;/P&gt;&lt;P&gt;ZROUTES: Flight routes&lt;/P&gt;&lt;P&gt;ZFLIGHTS: Flights&lt;/P&gt;&lt;P&gt;ZFLIGHTS_OPR: Flight operations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A flight route can be a rountrip which consists of many flights.&lt;/P&gt;&lt;P&gt;One route always has a route date. So the key fields should be:&lt;/P&gt;&lt;P&gt;ZROUTES&lt;/P&gt;&lt;P&gt;|--ROUTEID&lt;/P&gt;&lt;P&gt;|--RDATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A flight within one route has a specific flight date and time. So the key must be:&lt;/P&gt;&lt;P&gt;ZFLIGHTS&lt;/P&gt;&lt;P&gt;|--ROUTEID&lt;/P&gt;&lt;P&gt;|--RDATE&lt;/P&gt;&lt;P&gt;|--FDATE&lt;/P&gt;&lt;P&gt;|--FTIME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each flight I can have 0 to N operations. So the key would be:&lt;/P&gt;&lt;P&gt;ZFLIGHTS_OPR&lt;/P&gt;&lt;P&gt;|--ROUTEID&lt;/P&gt;&lt;P&gt;|--RDATE&lt;/P&gt;&lt;P&gt;|--FDATE&lt;/P&gt;&lt;P&gt;|--FTIME&lt;/P&gt;&lt;P&gt;|--OPR_NUM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it ok to do it this way? Or could I create a FLIGHTID for each flight in ZFLIGHTS like this:&lt;/P&gt;&lt;P&gt;ZFLIGHTS&lt;/P&gt;&lt;P&gt;|--FLIGHTID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case the fields ROUTEID, RDATE, FDATE and FTIME would not be part of the key any longer. When creating a new flight I would have to make shure that there is not already a flight for the same ROUTEID, RDATE, FDATE and FTIME.&lt;/P&gt;&lt;P&gt;But the advantage would be afterwards that I only have one foreign key entry in my table ZFLIGHTS_OPR (and every other table has a foreign key relationship with ZFLIGHTS):&lt;/P&gt;&lt;P&gt;ZFLIGHTS_OPR&lt;/P&gt;&lt;P&gt;|--FLIGHTID&lt;/P&gt;&lt;P&gt;|--OPR_NUM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you do the design? As I learned in my studies it's always better to have not redundant data in various database tables (like I have in the first solution with ROUTEID, RDATE, FDATE and FTIME). The only problem I have is to check if there's already a flight with the same values ROUTEID, RDATE, FDATE, FTIME in ZFLIGHTS, otherwise I would have two flight e.g. 0001 and 0002 for the same flight data. If ROUTEID, RDATE, FDATE, FTIME in ZFLIGHTS would be part of the key, it would be not possible to create another flight for the same data, because you cannot have duplicate keys.&lt;/P&gt;&lt;P&gt;So it would avoid to have wrong data in ZFLIGHTS to have a keey as mentioned in the first proposal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that would be the same if I have e.g. a table for staff ZSTAFF with key PERSID and none key fields NAME, GIVEN_NAME and START_DATE.&lt;/P&gt;&lt;P&gt;When I want to create a new person I first have to check if the same name is not already stored in the table (let's assume there's only one NAME, GIVEN_NAME and START_DATE combination).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are your suggestions? Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 06:48:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324945#M1030572</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-22T06:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Database design</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324946#M1030573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much R/3 data is based around repeat keys - so MARA has key MATNR, MARC has key MATNR, WERKS, MARD has MATNR, WERKS, LGORT (If I remember correctly ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in BI, a star-schema is used, with SIDS as the identifier, and fact tables etc. (search the help for more detail).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you propose is similar, and could lead to better performance.  As you say, you need additional checks, but that shouldn't really impact performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to weigh performance and resource consumption against the complexity of the program.  Space is cheap.  Processing power doubles each year.  The more complex a program is, however, the more it costs to develop, maintain and enhance.  And you may even need a better, and therefore more expensive, programmer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 08:22:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324946#M1030573</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-08-22T08:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Database design</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324947#M1030574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're right, additional checks have to be done when I create a FLIGHTID.&lt;/P&gt;&lt;P&gt;But otherwise I would have 6 key fields for ZFLIGHTS and 7 key fields for ZFLIGHTS_OPR.&lt;/P&gt;&lt;P&gt;So I prefer to use an ID in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think in terms of normalization and database design it's the better approach.&lt;/P&gt;&lt;P&gt;And for instance in SQL it's much more popular to use auto-increment IDs as table keys.&lt;/P&gt;&lt;P&gt;The bad thing in SAP is that you don't have auto-incrementation (as far as I know). You've to create a number range with an interval and have to generate the next number each time you're adding a new entry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 09:06:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324947#M1030574</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-22T09:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Database design</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324948#M1030575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been looking recently at persistence objects, and query services - it looks on the face of it that it could be relatively easy to develop auto-incrementation.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2008 09:48:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-design/m-p/4324948#M1030575</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-08-22T09:48:01Z</dc:date>
    </item>
  </channel>
</rss>

