Explain BusinessEntity tables in AdventureWorks2008R2

I'm designing my first enterprise level sql server database and want to use AdventureWorks2008R2 as a concept model to copy some of what it demonstrates re good design. But I'm struggling to understand how the BusinessEntity tables get populated.
Where is there documentation that explains how the BusinessEntity tables work?
Is there sample front end code that would demonstrate how the tables get populated etc? e.g. if the app adds a new employee/person what is the code for populating the BusinessEntity table. Is there code somewhere that demonstrates this?
I'm using LINQ to SQL for this project in case thats relevant.

A business entity is a person or business which has zero or more addresses and zero or more people related to it. For example, the people related
to a store would typically be purchasing agents of a retail sporting or bicycle store who buy bicycles wholesale from AdventureWorks Cycles. A person related to an employee might be the employee’s emergency contact. All business entities have a common key
(the BusinessEntityID). This allows us to build a conceptual model using the Entity Framework which demonstrates table per type inheritance. It also simplifies the schema by having a single table (Person.BusinessEntityAddress)
relate addresses to business entities instead of using specialized tables (for example
CustomerAddress, VendorAddress, EmployeeAddress.
The concept of a customer has also been broadened. In AdventureWorks for SQL Server 2005, a customer is either a store (wholesale) or an individual
(retail). In AdventureWorks2008R2 and 2012, a customer can be any person or a store. This enables employees (for example) to be customers without storing redundant information about them.
A Customer can be a Person or a Store.
For Example:
USE
AdventureWorks2012
GO
-- Customer as a Person. Jon Yang is the customer
SELECT
[PersonID]
,[CustomerID]
,[StoreID]
FROM
[AdventureWorks2012].[Sales].[Customer]
WHERE
CustomerID = 11000
GO
-- The BusinessEntityID represents the Person
SELECT
[BusinessEntityID]
,[FirstName]
,[LastName]
FROM
[AdventureWorks2012].[Person].[Person]
WHERE
[BusinessEntityID] = 13531
GO
-- Customer as a Store. A Bike Store is the customer
SELECT
[StoreID]
,[CustomerID]
,[PersonID]
FROM
[AdventureWorks2012].[Sales].[Customer]
WHERE
CustomerID = 1
GO
-- The BusinessEntityID represents the Store
SELECT
[BusinessEntityID]
,[Name]
FROM
[AdventureWorks2012].[Sales].[Store]
WHERE
BusinessEntityID = 934
GO
Also Answers:
http://social.msdn.microsoft.com/Forums/en-US/sqlserversamples/thread/dfc1c1f6-cf33-491e-aec1-5803cb406572

Similar Messages

  • Explain Plan Table

    Hi,
    I have created the plan_table using utlxplan.sql but still i am getting the error:
    ORA-02404: specified plan table not found          
    Is there something else to be done to get it fixed?
    please suggest.
    Regards
    Arpit

    As Lukasz suggested check the table privs between the schema where the table was created and the user trying to use it. Also make sure there's a synonym for the user using explain plan to get to the plan table easily; a public synonym might work best

  • Can someone explain the tables tab under function parameter declaration ?

    Hello,
    when declaring a function, part of its parameter interface is the tables tab. So if in FUNCTION1 i  declare a table: tdraw like draw  (optional)
    what does that mean ? does this mean that tdraw will be a table of type draw and at the same time it will be filled up with the same contents as draw has ?
    then how can other function (func2) use FUNCTION1 and its table ?
    so if inside func2  i also have an internal table AA like draw :
    so inside func2 i say:
    call function1
    tables:tdraw = AA
    does this mean that it will assign the result tdraw table of function1 to AA ?
    can someone explain details of internal tables and passing them as parameters ?
    and which table is assigned to which ?
    thank you

    Hi hassan,
    If you are talking about the tables parameter in SE37, when you declare a table tdraw like draw it only means you are declaring an internal table of type draw but the contents are not filled into it.
    In the source code of the program you have to write the code to fetch the data to tdraw and do the manipulations accordingly.
    Also, the tables you are declaring can be like the input table or can be used for output table.
    suppose u have 2 tables tab1 and tab2, tab1 you are going to input the values to it and the calculated values have to be in another table, you can use tab2 as the result table.
    hope it helps.
    award points if it helps.

  • Interpret EXPLAIN PLAN TABLE OUTPUT

    Please point me to some document to understand on how to interpret this data, especially " OUTLINE DATA ".
    ORCL > explain plan for select * from hr.employees e, hr.departments d where e.department_id = d.department_id ;
    Explained.
    Elapsed: 00:00:00.11
    ORCL > select plan_table_output  from table (DBMS_XPLAN.DISPLAY(NULL, NULL, 'ADVANCED')) ;
    PLAN_TABLE_OUTPUT
    Plan hash value: 1343509718
    | Id  | Operation                    | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |             |   106 |  9540 |     6  (17)| 00:00:01 |
    |   1 |  MERGE JOIN                  |             |   106 |  9540 |     6  (17)| 00:00:01 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| DEPARTMENTS |    27 |   567 |     2   (0)| 00:00:01 |
    |   3 |    INDEX FULL SCAN           | DEPT_ID_PK  |    27 |       |     1   (0)| 00:00:01 |
    |*  4 |   SORT JOIN                  |             |   107 |  7383 |     4  (25)| 00:00:01 |
    |   5 |    TABLE ACCESS FULL         | EMPLOYEES   |   107 |  7383 |     3   (0)| 00:00:01 |
    Query Block Name / Object Alias (identified by operation id):
       1 - SEL$1
       2 - SEL$1 / D@SEL$1
       3 - SEL$1 / D@SEL$1
       5 - SEL$1 / E@SEL$1
    Outline Data
      /*+
          BEGIN_OUTLINE_DATA
          USE_MERGE(@"SEL$1" "E"@"SEL$1")
          LEADING(@"SEL$1" "D"@"SEL$1" "E"@"SEL$1")
          FULL(@"SEL$1" "E"@"SEL$1")
          INDEX(@"SEL$1" "D"@"SEL$1" ("DEPARTMENTS"."DEPARTMENT_ID"))
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          DB_VERSION('11.2.0.1')
          OPTIMIZER_FEATURES_ENABLE('11.2.0.1')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
    Predicate Information (identified by operation id):
       4 - access("E"."DEPARTMENT_ID"="D"."DEPARTMENT_ID")
           filter("E"."DEPARTMENT_ID"="D"."DEPARTMENT_ID")
    Column Projection Information (identified by operation id):
       1 - (#keys=0) "D"."DEPARTMENT_ID"[NUMBER,22], "E"."DEPARTMENT_ID"[NUMBER,22],
           "D"."LOCATION_ID"[NUMBER,22], "D"."DEPARTMENT_NAME"[VARCHAR2,30],
           "D"."MANAGER_ID"[NUMBER,22], "E"."EMPLOYEE_ID"[NUMBER,22],
           "E"."FIRST_NAME"[VARCHAR2,20], "E"."LAST_NAME"[VARCHAR2,25],
           "E"."EMAIL"[VARCHAR2,25], "E"."PHONE_NUMBER"[VARCHAR2,20], "E"."HIRE_DATE"[DATE,7],
           "E"."JOB_ID"[VARCHAR2,10], "E"."SALARY"[NUMBER,22],
           "E"."COMMISSION_PCT"[NUMBER,22], "E"."MANAGER_ID"[NUMBER,22]
       2 - "D"."DEPARTMENT_ID"[NUMBER,22], "D"."DEPARTMENT_NAME"[VARCHAR2,30],
           "D"."MANAGER_ID"[NUMBER,22], "D"."LOCATION_ID"[NUMBER,22]
       3 - "D".ROWID[ROWID,10], "D"."DEPARTMENT_ID"[NUMBER,22]
       4 - (#keys=1) "E"."DEPARTMENT_ID"[NUMBER,22], "E"."EMPLOYEE_ID"[NUMBER,22],
           "E"."FIRST_NAME"[VARCHAR2,20], "E"."LAST_NAME"[VARCHAR2,25],
           "E"."EMAIL"[VARCHAR2,25], "E"."PHONE_NUMBER"[VARCHAR2,20], "E"."HIRE_DATE"[DATE,7],
           "E"."JOB_ID"[VARCHAR2,10], "E"."SALARY"[NUMBER,22],
           "E"."COMMISSION_PCT"[NUMBER,22], "E"."MANAGER_ID"[NUMBER,22]
       5 - "E"."EMPLOYEE_ID"[NUMBER,22], "E"."FIRST_NAME"[VARCHAR2,20],
           "E"."LAST_NAME"[VARCHAR2,25], "E"."EMAIL"[VARCHAR2,25],
           "E"."PHONE_NUMBER"[VARCHAR2,20], "E"."HIRE_DATE"[DATE,7],
           "E"."JOB_ID"[VARCHAR2,10], "E"."SALARY"[NUMBER,22],
           "E"."COMMISSION_PCT"[NUMBER,22], "E"."MANAGER_ID"[NUMBER,22],
           "E"."DEPARTMENT_ID"[NUMBER,22]
    68 rows selected.
    /

    "outline data" are a set of hints that enforce the use of the given plan.
    The best source on interpreting plans (I know) is: http://antognini.ch/papers/InterpretingExecutionPlans_20091017.pdf
    Regards
    Martin

  • About  EXPLAIN PLAN table

    Hi,
    This is just a sample query which I have executed on a recently installed Oracle ..
    SQL> explain plan for
    2 select * from emp
    3 where job = 'CLERK';
    select * from emp
    ERROR at line 2:
    ORA-02402: PLAN_TABLE not found
    When I have requested my DBA, he said, he couldnt find this (PLAN TABLE) utility in oracle .. Please advice me, from where can I get this utility ?? And how to proceed
    Regards

    SQL> explain plan for select sysdate from dual
      2  /
    Explained.
    SQL>  select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |       |       |       |
    |   1 |  TABLE ACCESS FULL   | DUAL        |       |       |       |
    Note: rule based optimization
    9 rows selected.Cheers
    Sarma.

  • Adventure works database sample question

    Dear all,
    I need to build a database structure for a shop which is actually selling home furniture and I have seen that quite many table from the AW database could fit my scenario but I have some points that I do not catch in that sample.
    If anyone could light my brain I will appreciate.
    1- First of all in many tables I can see a reference to a BusinessEntityID but could find any table where BusinessEntity is define ?
    2- In my scenario my company will have full control on the database and will resell the software to shops. Shops can be a single shop of belonging to a HeadOffice which is the owner of those shops. The following picture illustrate this
    - Shops Owner 1 to 3 are customers of My COMPANY
    - Shop 1 to Shop 3 are customers of respective ShopOwner
    How can I define and identify those entity in AW sample database ?
    Thnaks for help
    regards

    So does a BusinessEntiy is nothing else than a CUSTOMER in fact ?
    IN orther word does each of my blue box in my picture is a BusinessEntity = a Customer?
    May be it is just a matter of naming but need to catch it correctly :-)
    Hi wakefun,
    A business entity is a person or business which has zero or more addresses and zero or more people related to it. For example, the people related to a store would typically be purchasing agents of a retail sporting or bicycle store who buy bicycles wholesale
    from AdventureWorks Cycles. A person related to an employee might be the employee’s emergency contact.
    In AdventureWorks2008R2 and 2012, the concept of a customer has also been broadened, a customer can be any person or a store. This enables employees (for example) to be customers without storing redundant information about them.
    For more information about BusinessEntity tables in AdventureWorks2008R2, you can review the following post.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/dfc1c1f6-cf33-491e-aec1-5803cb406572/explain-businessentity-tables-in-adventureworks2008r2?forum=sqlserversamples
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Explain plan different with no stats but with no rows & rows in a table

    Hi All,
    This is in Oracle 8.1.7.4.0 DB.
    1. Query was taking long time to return rows. It was based on a view.
    2. View has multiple tables.
    3. The explain plan was showing one of the Table(e.g. TABLE1) using incorrect INDEX. At the time of explain plan table has no statistics.
    4. truncated Table TABLE1
    5. The explain plan now taking correct INDEX for the table TABLE1.
    How does optimizer choosing the incorrect index when rows in a table & correct index when there are no rows in the table ?
    any insights.
    Thanks
    Sandeep

    I don't know about your particular db version, but CBO in absence of statistics uses some default values (e.g. average row length 100 bytes) and also uses actual number of block for the table. I assume something similar might be for indexes.
    To be sure what has changed you can run 10053 level trace.
    Gints Plivna
    http://www.gplivna.eu

  • Need of Tables names that link Purchase Order and the Confirmation Number

    Hi All,
    Can any one help me please regarding EBP tables. I am new to EBP so not aware of data flow in the EBP data dictionary.
      Please can anyone explain the tables which link the Purchase order number and the Confirmation(Goods Receipt).
    Please do the needful.
    Thanks in advance.

    Hi,
      You can query the tables BBP_PDHGP and BBP_PDIGP to get teh refernce doc no for PO and then use FM BBP_PD_CONF_GETDETAIL to get the details fo a particular confirmation.ALso you can search confirmations by "Reference Document", use BBP_PD_CONF_GETLIST, with parameter I_REF_DOC_NO, and then use BBP_PD_CONF_GETDETAIL for the found confirmations.
    HTH.
    BR,
    Disha.
    PLs reward points for helpful answers

  • Table and structure

    can anybody explain both table & structure and difference between them.
    How these are used to create the functional spec.

    both have fields in them but the main differnce is table can store data wheras structure can only  take the data but can not store it
    if u are running a programme and the moment programme ends all the value mentioned in structure vanish out whereas if u have mentioned tha data in table fileds they would have get stored in database even after programme ends
    as the name suggest structure is a structure of a body but it has no soul means u  it is created to avoid redundency
    u can include a structure  in table but u cant include a structure in a table
    Edited by: Rahul Tyagi on Feb 26, 2008 3:51 PM

  • Invalid column name when executing explain plan

    SQL Developer version 4.0, SQL Worksheet, Windows 2000, Database 9.2.0.6.
    When attempted to run a explain plan on a simple two table join query, it generates error invalid column name. Removed aliases and simplify query to one table row count, and still get the same error. Even tried the schema owner and got the same error.
    I decided to check the explain plan table and found out that it was from an older version. Recreated the explain plan table and was able to run the explain plan.
    I'm just posting this in the event somebody else runs into the same problem.

    This was fixed in the 4.1 or 1215 build. Please update by downloading or check for updates.
    -thanks
    kris

  • Error in Import Manager if Constraints are assigned to lookup table

    Hi Folks,
    I am using the Repository SRM-MDM Catalog...and in the Console,
    For a Role, if I assign a Constraint for the lookup-table Product Groups, System shoots the error message in Import Manager when I try to Map the file.
    Scenario: Say I have Product Group from LOC1-LOC5, and for a Z-Catalog Manager Role(Manager1) if I assign the Constraint-LOC1.....and if I Import a file in the Import Manager, system shoots the error message "Unable to retrieve Unique values for Product Groups".

    Hi Mohan,
    Are you updating any Qualified table.Please explain what table and also some more details.
    Thanks
    Ganesh Kotti

  • Access data through table relationship

    i have some CMP Entity beans mapped to some pointbase tables. i designed a simple relationship between two tables PERSON and COUNTRY, where PERSON has an integer field that references to the COUNTRY primary key. the COUNTRY table has a string column containing the country's name.
    i have PERSON as an entity bean. how can i access the country name instead of the integer id that is passed at get/set? should i create a COUNTRY bean as well and create relationships ? or can i just access the name value using a simple query and return it instead of the class' getter?
    thanks in advance.

    if i didn't made much sense before when i explained the tables' structure, here it is:
    create table country
    id SMALLINT NOT NULL,
    name VARCHAR(50) NOT NULL,
    CONSTRAINT pk_country PRIMARY KEY (id)
    create table person
    id INTEGER NOT NULL,
    first_name VARCHAR(20) NOT NULL,
    last_name VARCHAR(20) NOT NULL,
    country SMALLINT,
    CONSTRAINT pk_id PRIMARY KEY (id),
    CONSTRAINT fk_country FOREIGN KEY (country) REFERENCES country(id)

  • Question on Plan Table

    Hi,
    This is the Explain Plan for one of my SQL queries
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  | Inst   |IN-
    OUT|
    |   0 | SELECT STATEMENT     |             |   101 |  7676 |    60 |        |
    PLAN_TABLE_OUTPUT
       |
    |   1 |  SORT ORDER BY       |             |   101 |  7676 |    60 |        |
       |
    |   2 |   NESTED LOOPS OUTER |             |   101 |  7676 |    50 |        |
       |
    |   3 |    VIEW              |             |   100 |  2400 |     5 |        |
       |
    PLAN_TABLE_OUTPUT
    |   4 |     UNION-ALL        |             |       |       |       |        |
       |
    |   5 |      REMOTE          |             |       |       |       | MKTG   | R-
    S ||   6 |      REMOTE          |             |       |       |       | MKTG   | R-
    S ||   7 |    REMOTE            |             |     1 |    52 |     1 | MKTG   | R-
    S |PLAN_TABLE_OUTPUT
    Note: cpu costing is off, PLAN_TABLE' is old versionI am concerned about the note "cpu costing is off"
    Does this mean my optimizer is RBO?
    Moreover, what is the cost cloumn in the explain plan table meant by?
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE 9.2.0.6.0 Production
    TNS for HPUX: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    I did 'select cpu_cost' from v$sql_plan;'
    The column results in NULL values.
    Thanks
    Rajiv

    Hi Justin,
    I ran into some serious problem here.
    As per the suggestions given, this is the modified query
    SELECT   x.rep_date,
                   x.certificate_id,
                   x.member_kit_flag,
                   y.enabled_date,
                   y.disabled_date,
                   TRUNC(y.creation_date) - TRUNC(x.rep_date) days,
                   y.csg_account_no
              FROM (SELECT /*+ DRIVING_SITE(pt_gift_cert_referrals) */ a.*,
                           /*+ DRIVING_SITE(pt_cd_mailings) */ b.member_kit_flag,
                           to_date(b.shipment_date,'dd MON YYYY') rep_date
                      FROM pt_gift_cert_referrals@mktg a,
                           pt_cd_mailings@mktg b
                     WHERE a.cert_mailing_id = b.cert_mailing_id
                       AND to_date(b.shipment_date,'dd MON YYYY') >= '22-AUG-2003'
                    UNION ALL
                    SELECT /*+ DRIVING_SITE(pt_gift_cert_referrals) */ a.*, /*+ DRIVING_SITE(pt_certificate_referrals) */
                           'Z' member_kit_flag,/*+ DRIVING_SITE(pt_cert_stage_log) */
                           to_date(b.creation_date,'dd MON YYYY') rep_date
                      FROM pt_gift_cert_referrals@mktg a,
                           pt_cert_stage_log@mktg b
                     WHERE a.cert_event_id = b.cert_event_id
                       AND SUBSTR(b.process_type, 1, 14) = 'CLUBDISH DAILY'
                       AND to_date(b.creation_date,'dd MON YYYY') >= '22-AUG-2003') x,
                   pt_certificate_referrals@mktg y
             WHERE x.certificate_id = y.certificate_id(+)
          ORDER BY rep_date,
                   x.certificate_id;Unfortunately, the query resulted in NO rows.
    no rows selected
    Elapsed: 00:02:31.03
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=60 Card=101 Bytes=76
              76)
       1    0   SORT (ORDER BY) (Cost=60 Card=101 Bytes=7676)
       2    1     NESTED LOOPS (OUTER) (Cost=50 Card=101 Bytes=7676)
       3    2       VIEW (Cost=5 Card=100 Bytes=2400)
       4    3         UNION-ALL
       5    4           REMOTE*                                            MKTG.WOR
                                                                           LD
       6    4           REMOTE*                                            MKTG.WOR
                                                                           LD
       7    2       REMOTE* (Cost=1 Card=1 Bytes=52)                       MKTG.WOR
                                                                           LD
       5 SERIAL_FROM_REMOTE            SELECT /*+ */ "A2"."CERTIFICATE_ID","A2"."GI
                                       FT_CSG_ACCOUNT_NO","A2"."CERT_PROMOT
       6 SERIAL_FROM_REMOTE            SELECT /*+ */ "A2"."CERTIFICATE_ID","A2"."GI
                                       FT_CSG_ACCOUNT_NO","A2"."CERT_PROMOT
       7 SERIAL_FROM_REMOTE            SELECT "CERTIFICATE_ID","CSG_ACCOUNT_NO","EN
                                       ABLED_DATE","DISABLED_DATE","CREATIO
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            338  bytes sent via SQL*Net to client
            234  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              0  rows processedThe thing more bothering is, optimizer is not using the DRIVING_SITE hint
    Previous Execution Plan was....
    6742176 rows selected.
    Elapsed: 03:15:20.07
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=53 Card=100 Bytes=76
              00)
       1    0   SORT (ORDER BY) (Cost=53 Card=100 Bytes=7600)
       2    1     NESTED LOOPS (OUTER) (Cost=50 Card=100 Bytes=7600)
       3    2       VIEW (Cost=5 Card=100 Bytes=2400)
       4    3         UNION-ALL
       5    4           REMOTE*                                            MKTG.WOR
                                                                           LD
       6    4           REMOTE*                                            MKTG.WOR
                                                                           LD
       7    2       REMOTE* (Cost=1 Card=1 Bytes=52)                       MKTG.WOR
                                                                           LD
       5 SERIAL_FROM_REMOTE            SELECT "A2"."CERTIFICATE_ID","A2"."GIFT_CSG_
                                       ACCOUNT_NO","A2"."CERT_PROMOTION_ID"
       6 SERIAL_FROM_REMOTE            SELECT "A2"."CERTIFICATE_ID","A2"."GIFT_CSG_
                                       ACCOUNT_NO","A2"."CERT_PROMOTION_ID"
       7 SERIAL_FROM_REMOTE            SELECT "CERTIFICATE_ID","CSG_ACCOUNT_NO","EN
                                       ABLED_DATE","DISABLED_DATE","CREATIO
    Statistics
              0  recursive calls
             14  db block gets
              0  consistent gets
          14173  physical reads
              0  redo size
      112195379  bytes sent via SQL*Net to client
        3146621  bytes received via SQL*Net from client
         449480  SQL*Net roundtrips to/from client
              0  sorts (memory)
              1  sorts (disk)
        6742176  rows processedAny help on this would be greatly appreciated.
    Thanks
    Rajiv

  • Why  it is taking full table scan when index is available

    Hi all,
    I am facing a strange problem with index.
    I created index on a column like
    1. CREATE INDEX ASSETS_ARTIST_IDX2 ON ASSETS(artist).
    SELECT asset.artist AS NAME FROM ASSETS asset WHERE asset.artist LIKE 'J%'
    Explain Plan : INDEX RANGE SCAN
    2. CREATE INDEX ASSETS_ARTIST_IDX2 ON ASSETS(UPPER (TRANSLATE (artist, ',;:"', ' ')));
    SELECT asset.artist AS NAME FROM ASSETS asset WHERE UPPER (TRANSLATE (artist, ',;:"', ' ')) LIKE 'J%'
              Explain Plan : TABLE ACCESS FULL
    first time it is taking index range scan,but in second situation scaning full table.Please let me know how to avoid the full table scan.
    Regards,
    Rajasekhar

    Actually, I misseunderstood damorgan' s statement about NULL and OP did not provide table definition. So based on FTS I would say it is more likely column is NULLable, otherwise I would expect INDEX FAST SCAN:
    SQL> create table emp1 as select * from emp
      2  /
    Table created.
    SQL> create index emp1_idx1 on emp1(empno)
      2  /
    Index created.
    SQL> exec dbms_stats.gather_table_stats('SCOTT','EMP1');
    PL/SQL procedure successfully completed.
    SQL> desc emp1
    Name                                                                     Null?    Type
    EMPNO                                                                             NUMBER(4)
    ENAME                                                                             VARCHAR2(10)
    JOB                                                                               VARCHAR2(9)
    MGR                                                                               NUMBER(4)
    HIREDATE                                                                          DATE
    SAL                                                                               NUMBER(7,2)
    COMM                                                                              NUMBER(7,2)
    DEPTNO                                                                            NUMBER(2)
    SQL> explain plan for
      2  select empno
      3  from emp1 where UPPER(TRANSLATE(empno, ',;:"', ' ')) LIKE '7%'
      4  /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 2226897347
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     4 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP1 |     1 |     4 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter(UPPER(TRANSLATE(TO_CHAR("EMPNO"),',;:"',' ')) LIKE '7%')
    13 rows selected.
    SQL> alter table emp1 modify empno not null
      2  /
    Table altered.
    SQL> explain plan for
      2  select empno
      3  from emp1 where UPPER(TRANSLATE(empno, ',;:"', ' ')) LIKE '7%'
      4  /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 2850860361
    | Id  | Operation        | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |           |     1 |     4 |     1   (0)| 00:00:01 |
    |*  1 |  INDEX FULL SCAN | EMP1_IDX1 |     1 |     4 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter(UPPER(TRANSLATE(TO_CHAR("EMPNO"),',;:"',' ')) LIKE '7%')
    13 rows selected.
    SQL> SY.

  • Settlements of internal orders: which table?

    Hi All,
    could anyone tell me in which table, the items of settlement (t.code KO88) for internal orders are stored?
    Thanks

    Hi,
    the settlement result (CO document line items) as already explained in table COEP, the settlement rule / distribution rules in tables COBRA / COBRB.
    best regards, Christian

Maybe you are looking for