Use a common table with many to many relationship

Hello,
I have two SQL tables: Job and Employee. I need to compare Job Languages Proficiencies and Employee Languages Proficiencies. A Language Proficiency is composed by a Language and a Language Level.
create table dbo.EmployeeLanguageProficiency (
EmployeeId int not null,
LanguageProficiencyId int not null,
constraint PK_ELP primary key clustered (EmployeeId, LanguageProficiencyId)
create table dbo.JobLanguageProficiency (
JobId int not null,
LanguageProficiencyId int not null,
constraint PK_JLP primary key clustered (JobId, LanguageProficiencyId)
create table dbo.LanguageProficiency (
Id int identity not null
constraint PK_LanguageProficiency_Id primary key clustered (Id),
LanguageCode nvarchar (4) not null,
LanguageLevelId int not null,
constraint UQ_LP unique (LanguageCode, LanguageLevelId)
create table dbo.LanguageLevel (
Id int identity not null
constraint PK_LanguageLevel_Id primary key clustered (Id),
Name nvarchar (80) not null
constraint UQ_LanguageLevel_Name unique (Name)
create table dbo.[Language]
Code nvarchar (4) not null
constraint PK_Language_Code primary key clustered (Code),
Name nvarchar (80) not null
My question is about LanguageProficiency table. I added an Id has PK but I am not sure this is the best option.
What do you think about this scheme?
Thank You,
Miguel

That should be find as you alread have unique  non clustered index on the other two columns. you can also define this way 
create table dbo.LanguageProficiency (
Id int identity not null,
LanguageCode nvarchar (4) not null,
LanguageLevelId int not null,
constraint PK_LanguageProficiency_Id primary key Nonclustered(LanguageCode, LanguageLevelId)
Create CLUSTERED index CL_ID on dbo.LanguageProficiency(ID)
What you is need is -- FOreign key constraints between these tables. I see that you are columns but are not enforcing Foreign key constraints.. you need those..
Also you have composite primary keys, unless you guarantee that they will ever increasing numbers, it is not useful to define a composite PK.. it leads to page spilts...
Hope it Helps!!

Similar Messages

  • Use of internal table with hearerline in ABAP OO

    Hi,
    I have a very basic question regarding the use of Internal table with headerline in ABAP OO.
    I consider the concept of Internal table with header as one of the most features of ABAP, which is not there in any of the other porgramming languages.
    I accept that OO's concept is one of the most powerful and a very good concept. We should also implement OO's concept in ABAP.
    But my concern is why in the process of moving to OO's the concept of Internal table with headerline is no more used.
    Can any one tell me the main reason for this. Is there any technical reason for this. By this i mean anything to do with memory or effeciency.
    Thanx,
    Srinivas

    Hi Srinivas,
       here is something more which i found about the same
    follow this link
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5ac31178-0701-0010-469a-b4d7fa2721ca
    and search for header line.
    it says:
    Tables with header lines not allowed
    Only tables without header lines can be declared in ABAP Objects.
    Error message in ABAP Objects if the following syntax is used:
    DATA itab TYPE LIKE TABLE OF ... WITH HEADER LINE.
    Correct syntax:
    DATA: itab TYPE LIKE TABLE OF ... ,
    wa LIKE LINE OF itab.
    Reason:
    It depends on the statement whether the body or header line of a table is accessed. The table name should identify the table uniquely. Programs are easier to read. Tables with header lines do not improve performance.
    i hope this will help you.
    regards,
    Kinshuk
    PS mark helpful answers

  • BADI cant use an internal table with header line

    hi,
         In BADI, we cant use an internal table with header line, and I am calling a function module which requires internal table as import parameter, now, the table I am passing is without a header line, So how to solve this problem ?

    You can use a type and then create an internal table of that type.
    types :
    begin of t_<example>
    *field list
    end of t_<example>
    data :
    gt_<table> type standard table of t_<example>
    pass this to the FM

  • What are the advantages of using an internal table with workarea

    Hi,
    can anyone tell me
    What are the advantages of using an internal table with workarea
    over an internal table with header line?
    thnks in adv
    regards
    nagi

    HI,
    Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
    <b>Difference between Work Area and Header Line</b>
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    e.g.
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table
    1) The difference between
    whih header line and with out heater line of internal table.
    ex:-
    a) Data : itab like mara occurs 0 with header line.
    b) Data: itab like mara occurs 0.
    -While adding or retrieving records to / from internal table we have to keep the record temporarily.
    -The area where this record is kept is called as work area for the internal table.
    -The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    -Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    a) Data : itab like mara occurs 0 with header line.
    table is with header line
    b) Data: itab like mara occurs 0.
    table is without header line
    2)work area / field string and internal table
    which one is prefarable for good performance any why ?
    -The header line is a field string with the same structure as a row of the body, but it can only hold a single row , whereas internal table can have more than one record.
    In short u can define a workarea of an internal table which means that area must have the same structure as that of internal table and can have one record only.
    Example code:
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    Regards,
    Padmam.

  • Problem using 2 Fact tables with the same dimension

    Hi,
    I have noticed a very strange behaviour in Presentation Services / BI Administrator. I have 2 cubes (created in OWB) which are in the same business model, they are set up with foreign keys etc. and works as they should using them separately. Problem is (sometimes!) when I want to use the common dimension (Project) against both of the fact tables (Sales Order and Purchase Order).
    Scenario 1:
    If I use Project Id, Purchase Amount, Sales Amount I get either an amount in Sales Amount or in Purchase Amount, BUT if the Project Id starts with a letter (not starting with a number) it will show the correct amount for both Sales- and Purchase Amount.
    Scenario 2:
    I use Project Description (even followed by Project Id or not), Sales Amount, Purchase Amount I get the correct numbers for all projects. Project Description must come before Project Id or else it will not work.
    I only noticed this problem when using both of the Fact tables since I want to compare Sales Amount and Purchase Amount in each Project. The Dimension for Project consist of Project, Sub Project and Activity and works fine. If I only use Sales Amount or Purchase Amount with Project Id I don't get this error. Only when both numbers are used.
    I would be very happy if anyone have a good solution/explanation to this problem! Seems like could be something in the BI Server memory that goes wrong somewhere.

    The strange thing is that the results from the queries are correct running them in SQL Developer. This is one that works:
    SELECT Project.Project saw_0, "- SalesOrderFact"."Sales Amount" saw_1, "- PurchaseOrderFact"."Purchase Amount" saw_2, REPORT_SUM(saw_1 BY ), REPORT_SUM(saw_2 BY ) FROM SalesOrder ORDER BY saw_0
    SALES ORDER:
    select T3032.PROJECT_DESCRIPTION as c1,
    sum(T161.SALES_AMOUNT_LOCAL) as c2
    from
    DIM_PROJECT_V T3032,
    CUBE_SALES_ORDER T161
    where ( T161.DIM_PROJECT = T3032.DIMENSION_KEY )
    group by T3032.PROJECT_DESCRIPTION
    order by c1
    PURCHASE_ORDER:
    select T3032.PROJECT_DESCRIPTION as c1,
    sum(T3020.TOTAL_BUY_AMOUNT) as c2
    from
    DIM_PROJECT_V T3032,
    CUBE_PURCH_ORDER T3020
    where ( T3020.DIM_PROJECT = T3032.DIMENSION_KEY )
    group by T3032.PROJECT_DESCRIPTION
    order by c1
    And this will give the wrong result in Answers (correct in SQL..):
    SELECT Project."Project Id" saw_0, "- SalesOrderFact"."Sales Amount" saw_1, "- PurchaseOrderFact"."Purchase Amount" saw_2, REPORT_SUM(saw_1 BY ), REPORT_SUM(saw_2 BY ) FROM SalesOrder ORDER BY saw_0
    SALES_ORDER:
    select T3032.PROJECT_KEY_NAME_ID as c1,
    sum(T161.SALES_AMOUNT_LOCAL) as c2
    from
    DIM_PROJECT_V T3032,
    CUBE_SALES_ORDER T161
    where ( T161.DIM_PROJECT = T3032.DIMENSION_KEY )
    group by T3032.PROJECT_KEY_NAME_ID
    order by c1
    PURCHASE_ORDER:
    select T3032.PROJECT_KEY_NAME_ID as c1,
    sum(T3020.TOTAL_BUY_AMOUNT) as c2
    from
    DIM_PROJECT_V T3032,
    CUBE_PURCH_ORDER T3020
    where ( T3020.DIM_PROJECT = T3032.DIMENSION_KEY )
    group by T3032.PROJECT_KEY_NAME_ID
    order by c1
    As you can see the SQL look very familiar, and I cannot see anything in SQL that should be the cause of this error. I think the error must be in the BI Memory or something.
    Any ideas?

  • Problem in using MultiSelect ADF table with view Object

    I have a requirement of displaying a table with multi select option. On page load table will be displayed with all columns as output text except last column as input text. User can update the last column of the selected row and only checked rows should get updated in the DB Table.
    Is there any document or Tutorial available?

    Hi,
    this is an individual implementation. Tutorials are written for common usecases. However, the way to implement this is to set the read-only property on the last column's text field (turn it into a textinput field) based on whether or not the row is selected. Make sure that the row selection PPRs the table
    for a code example download
    http://thepeninsulasedge.com/frank_nimphius/wp-content/uploads/2008/05/OldAndLostBlogBusterTips.zip
    and look at page 272 "ADF Faces: Conditional table row manipulation on table row select"
    Frank

  • How to use dynamic internal table with FOR ALL ENTRIES

    Hello SDNers,
    I am having a dynamic internal table & want to use FOR ALL ENTRIES(FAE) using this dyn. table.
    This works fine for me:
    IF <lt_tmp> IS NOT INITIAL. "<lt_tmp> is my dyn. internal table
            SELECT field1 field2
              FROM TABLE ztable
              INTO TABLE itab "Itab is a static table
              FOR ALL ENTRIES IN <lt_tmp>
              WHERE (lv_dynwhere). "lv_dynwhere -> dynamic where clause
          ENDIF.
    SAP documentation says:
    "The logical expression sql_cond of the WHERE condition can be comprised of several logical expressions using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one comparison with a column of the internal table itab that can be specified statically or dynamically. "
    How do we specify the column of the internal table dynamically ? Can we do something like this:
    IF <lt_tmp> IS NOT INITIAL. "<lt_tmp> is my dyn. internal table
            SELECT field1 field2
              FROM TABLE
              INTO TABLE itab "Itab is a static table
              FOR ALL ENTRIES IN <lt_tmp>
              WHERE key_field1 = (dynamic token for column1 of <lt_tmp>)
                           key_field2 = (dynamic token for column2 of <lt_tmp>)
          ENDIF.
          ENDIF.
    Let me know if i am not clear about my requirement.
    BR,
    Suhas

    Hello Thomas,
    What i meant was something like this:
    WHERE key_field1 = ('<LT_TMP-COL1>') AND
          key_field2 = ('<LT_TMP-COL2>')
    I am confused by what SAP means with "dynamic representation of internal table columns" in FAE ?
    @Rob: I was referring to SAPNW 7.0 documentation & the phrase (release 6.40 & higher) is missing. Anyways fyi i am on ECC5.0 ABAP release 6.40.
    @Subhankar: This is what Marcin had proposed in For all entries and dynamic table.
    Thanks,
    Suhas
    Edited by: Suhas Saha on Apr 6, 2010 11:53 AM

  • Use of selection table with 4 fields

    Hi everyone
    Can someone please explain to me what is the use of the seltab 4 fields, how they are used and provide an example, cos Im kinda struggling understanding them...
    Thanks in advance
    Adam

    Hi,
    Explicity there is a selection table for select-options that is seltab and it have sign, low, high, and option.
    Actually these values are also available in ranges.
    Just to explain you go through this info.
    What are the difference between SELECT-OPTIONS & RANGES?
    Here both SELECT-OPTIONS & RANGES works for the same purpose. They both are used for the range selection from selection screen. The main diff. between them is, while we use SELECT-OPTIONS system implicitly creates the select options internal table which contains the fields of SIGN,OPTION,LOW & HIGH. But in case of RANGES, this internal table should be defined explicitly.
    Eg. to SELECT-OPTIONS :
    REPORT YARSELECT.
    TABLES YTXLFA1.
    SELECT-OPTIONS : VENDOR FOR YTXLFA1-LIFNR.
    INITIALIZATION.
    VENDOR-LOW = 1000. " It specifies the range starting value.
    VENDOR-HIGH = 2000. " It specifies the range ending value.
    VENDOR-OPTION = 'BT'. " specifies ranges value is in between.
    VENDOR-SIGN = 'I'. "specifies both inclussive.
    APPEND VENDOR.
    SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB
    WHERE LIFNR IN VENDOR.
    Eg. to RANGES:
    REPORT YARRANGE.
    TABLES YTXLFA1.
    RANGES: VENDOR FOR YTXFLA1-LIFNR.
    SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB
    WHERE LIFNR IN VENDOR.
    Here with RANGES user has to design an internal table with fields -
    SIGN,OPTION,LOW and HIGH EXPLICITLY.
    >
    Example:
    select-options: bukrs for zstock-bukrs.
    Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look like this:
    IEQABFI
    This is because BUKRS is set as a table as follows:
    begin of bukrs occurs 0,
    SIGN(1) type c,
    OPTION(2) type c,
    LOW like bukrs,
    HIGH like bukrs,
    end of bukrs.
    Now, when you create the following range, it will have the exact same fields set inside its table:
    Ranges: bukrs for zstock-bukrs.
    The difference is, because ranges doesn't show on the selection screen, you will have to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low & bukrs-high all manually.
    Some tips:
    Sign is always I (for Include) or E (for Exclude)
    Option can be a whole range, which includes:
    EQ (Equal)
    BT (Between))
    CP (Contain Pattern)
    So let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow:
    ranges: bukrs for zstock-bukrs.
    bukrs-sign = 'E'. "Exclude
    bukrs-option = 'CP'. "Pattern
    bukrs-low = 'AB*'. "Low Value
    bukrs-high = ''. "High Value
    append bukrs.
    Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.
    Hope this explains it well enough.
    >
    What does SIGN "I" & "E" mean?
    The "I" stands for Include, and the "E" for Exclude.
    The easiest way to learn how the range selections work is, create the following dummy program:
    report dummy.
    tables: mara.
    select-options: matnr for mara-matnr.
    start-of-selection.
    loop at matnr.
    write: / matnr-sign,
    matnr-option,
    matnr-low,
    matnr-high.
    endloop.
    Run this program, and fill in a lot of junk into MATNR. Fill in some includes, some excludes, some ranges, etc., and you will soon realise how the system builds ranges (select-options). Once you know that, you can fill your own ranges quickly and efficiently.
    Hope this info helps.
    Regards,
    Kumar.

  • How to use single buffered table with FOR ALL ENTRIES KEYWORD

    Hai,
    I'm Using TJ02T Database table, It is single buffered table but at the same time I want to use FOR ALL ENTRIES KEYWORD , Please Help me.
    Regards,
    S.Janani

    Hi,
    FOR ALL ENTRIES will not depend on the buffering nature of the table. The single buffered table will only only buffer one record into memory. You can still use the statement to query the values, but it may have performance problems if the data volume is high since the records are not completely buffered into memory, the time will spent in getting data from DB.
    Thanks..
    Preetham S

  • SOA 11g DBAdapter Polling using a Sequencing Table with a DATE Field

    Hi.
    I have implemented a polling solution using a sequencing table that references a DATE column. For the most part the poll works correctly, but on occasion, I am not seeing a BPEL process instantiation for various records that get created in my source table.I have also noticed that in this particular case, the DATE field content on one or more source records is exactly the same --> "YYYYMMDDhhmmss".
    I just want to confirm here, that the polling adapter should be able to pick up multiple records from the source table, even though the date field is exactly the same. As well, how should I go about trying to debug this issue, if point #1 is handled by the system. Is there is a specific log or trace file that I can look at. Also, could I be facing a timing issue ?
    Can someone please comment on this.
    Thanks.

    In my table, I don't see a primary key, but only a unique index. I would assume then, that this would be analogous to the primary key capture; noticed that currently this code was only using one column out of two, from the unique index itself.
    Also, is the date content issue that I mentioned above a moot point then, based upon not having the correct primary key/unique key data pointers established ?
    Thanks.

  • Using Color Lookup Tables with cwgraph3d

    Hi,
    When searching old forums and other references, I can only find information regarding using color lookup tables in labview and I am using VB6.
    I want to let the user to pick a given amount of colors, have this turned into a gradiant over a table of size 256, and then using the custom colormaptstyle in my 3d graph. I want to be able to change the palette in real time to change my image. Basically I want to have the color palette screen to show up all the time and that gradiant that appears on the right side(vertically) to be my new color lookup table for the image(if that makes any sense).
    Thanks. Any help would be greatly appreciated.
    Kevin
    [email protected]

    Hello Kevin,
    Attached is a small VB6 example that uses the CWGraph3D's ColorMap properties. I think this will demonstrate the color lookup table capability that you're asking about, and you'll be able to use this as a building block for your own application.
    David Mc.
    NI Applications Engineer
    Attachments:
    colormap.zip ‏5 KB

  • Using one azure table storage account for many customers with their own data

    I'm developing app that will allow the customers to store their data in azure. However, currently I have no idea how to split  accounts of the customers in azure. Yes, I'm just started to read the documentation, but maybe someone can point me to the
    right topic?

    It seems like it might be worth starting from the general guidance to developing multitenant cloud applications - this resource might help: http://msdn.microsoft.com/en-us/library/ff966499.aspx
    The patterns covered in this guidance might apply to data storage mechanism chosen for the application - whether it's Azure Storage , Azure SQL DB or else.

  • Unable to use two af:tables with differing coloring (skins)?

    Im trying to configure the Siebel Self-Services application and customize the skinning. I have some problems though, because i need to show two af:tables on the same page, but with different coloring. One with black background and white text (both header and body) and one with white background and black text. I have tried to use styleClass:es, but the css parameters set for the af table are overriding the ones set in the stylesheets.
    Anyone having an idea how to overcome this?
    Thanks
    /Jon-Erik

    Hi,
    if the styleClass name is table1 then the skin selector would be something like
    .table1 af|table
    or .afTable.af|table
    I don't see how this can be overriden. If you assumption is that the style class reference must be to a CSS definition on the page then this indeed does not work. The styleClass name is kind of a named identifier for the component to skin and is used to further qualify the component to skin
    Frank

  • Emailbody using SQL: Align Table with Headers

    I have a requirement, Where I need to align header and table contents , as a part EMAIL body in HTML format. I'm getting the resultset from a table.
    Here is the output
    Rows in these Columns have following maximum length:
    Table Name :Maximum length of table name is 40.
    Building: Maximum length is 15
    CreatedDate: Maximum length is 25
    I would appreciate it if someone can help me on this.
    Thanks in advance.
    ZK

    Hi,
    The Integration Services SendMail task only supports mail messages in plain text format. However you can easily send HTML mail messages by using the Script task and the mail capabilities of the .NET Framework.
    Please refer to the following articles about this topic:
    Sending an HTML Mail Message with the Script Task:
    http://technet.microsoft.com/en-us/library/ms403365(v=sql.90).aspx
    SSIS - Data Table displayed in Script HTML Email Body:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bc395a54-da68-4041-b142-5108a5ad250c/ssis-data-table-displayed-in-script-html-email-body?forum=sqlintegrationservices
    If you have any more questions regarding SSIS, I would suggest you open a new thread in SSIS forum for better support.
    If you have any feedback on our support, please click
    here.
    Elvis Long
    TechNet Community Support

  • IW37n using the Planning Table with Overall Profile for Wrk Cnter Hierarchy

    Dear Experts,
      We are using IW37n to sort and filter our orders.  From there we make a selection and then GOTO the planning table to use for dispatch.  We copied the overall Profle to allow us to define the Evaluation Profile to allow for a Work Center Hierarchy and Plant to be defined.
    If I run CM25 using the overall profile the Work Center Hierarchy works fine.  If I use IW37n,  enter the same overall profile it does not execute the CM25.  Is there something else we should to get the CM25 to run?
    Regards,
    Roseanne

    Can I take this out a little further.  I verified with two orders that indeed both are being shown coming through IW37n or CM25.  I've determined that the profile is being called.  The layout shown in Chart 2 is correct.  It's chart 1 that is not showing the work center hierarchy correct from IW37n, it only shows the top node of the work center.  We have two scenario, one work center is defined with the employee linked to HRMS.  The lower node is a work center used to schedule too.  The other work center structure is the employees are defined as work centers.  We build the order to the top node and then use the hierarchy to schedule to each individual work center.  In both cases using IW37n, the lower level work centers are not shown in chart 1.
    If running CM25 independent it works fine.
    Regards,
      Roseanne

Maybe you are looking for

  • Power Supply Temperatures Running Hot! Mac Pro shuts down.

    Hello, First I will give machine/hardware specs of interest: 2 x 3 GHz Quad-Core Intel Xeon (pre 2009) 8 GB 800 MHz DDR2 FB-DIMM NVIDIA Quadro FX 5600 (running 2 displays) Apple RAID Card/Controller SMC Version: 1.25f4 *venting dimensions around comp

  • How do i save a sound attachment from a text message

    How do I save a sound from a text message on my iphone 4s?

  • How to enter bios pavilion dv7

    I cannot figure out how to enter bios on my pavilion dv7-1135NR, i need to figure out how to change boot order!

  • List of Codes In Material Master

    Dear Sir, How can we know the list of all codes created in material master according to there category like MRM ERM etc... If any one know good way pls answer soon Thanks & Regard Ajay Pareek

  • Sony RAW files

    Just got a new Sony NEX 20 camcorder which records still photos as Raw files in the .awr format. Can't seem to open in Photoshop CS5, even with Camera Raw 6.5 plug-in installed.  Any ideas?