How to represent multiple values in one column

Hi,
I need some help in designing a schema for this problem.
I have :
- 4 domains
- In each domain there will be many groups
- users belong to multiple groups in multiple domains
Eg.
user1 might be in groups g1, g2 and g3 in domains d1, d2
In a text file I represent it like this:
user1 | d1 | g1,g2,g3
user2 | d2 | g1, g2
etc.,
How do design a schema for this. I don't like the idea of having comma
separated values in columns.
Thanks.

Good instincts. You don't want to have comma-separated values in a column, that violates basic normalization rules.
You would probably want something like this
CREATE TABLE usr (
  user_pk
  user_id
CREATE TABLE grp (
  group_pk
  group_id
CREATE TABLE domain (
  domain_pk,
  domain_name
CREATE TABLE domain_group (
  domain_pk,
  group_pk
CREATE TABLE user_group (
  user_pk,
  group_pk
)where you create separate tables that map different things to each other. domain_group shows which groups are associated with a particular domain, user_group shows which users are associated with a particular group.
Justin

Similar Messages

  • Multiple value in one column issue

    Dear proffessionals,
    i'm trying to put more than one value in one column, so i have next problem:
    1. Query select cr_pjid from acc_users where username='ACCBTPS121' give result
    CR_PJID 
    '26','63'2. Query select * from acc_accbtp_nova_view where ed_id=2 and to_char(pj_id) in ('26','63'); return 186 rows.
    3. Query: select * from acc_accbtp_nova_view where ed_id=2 and
                  to_char(pj_id) in (select cr_pjid
                  from acc_users
                  where username='ACCBTPS121'); doesn't return any row... :(
    Could anyone help me ?
    Thx in advance,
    Adnan

    After researching, I think that the best idea is to create another table with multiple rows and different values for one column...
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425]

  • Retrieving multiple values from one column in SELECT statement

    Hi,
    I have a slight dilemma in that I'm trying to pull down all the values from a column from a select statement that includes some JOINS in it.
    If I run the query at the SQL Plus prompt, it pulls back all the values/rows.
    When I run the select (and prepared ) statement in my JSP, it only pulls back one of the 4 values I'm trying to retrieve.
    e.g.
    at the DB level :
    SELECT role_name, CC_ID FROM votetbl a
    INNER JOIN APPROVERS b ON
    a.BUSVP = b.BUSVP AND
    a.BRANCH = b.BRANCH
    WHERE CC_ID = 1688this will return:
    ROLE_NAME CC_ID
    ops 1688
    ops 1688
    comply 1688
    legal 1688
    comply 1688
    When run in my JSP, like so:
    String primID3a = request.getParameter("primID");
    Statement stmtovoter = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    String prepvotSQL = "SELECT role_name, CC_ID FROM votetbl a INNER JOIN APPROVERS b ON a.BUSVP = b.BUSVP AND " +
                         "a.BRANCH = b.BRANCH WHERE CC_ID = ?";
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    out.println("Vote category: "+votecat);I only get ops returned.
    Do I need to run an enumerator? Or reqest.getParameterValues or use a while statement around the results set?
    Any feedback and direction here is welcomed!
    Thanks!

    Actually, I tried looping and still only get 1, but returned several times.
    i.e.
    PreparedStatement prepvotstmt = connection.prepareStatement(prepvotSQL);
    prepvotstmt.setString(1, primID3a);
    ResultSet rest3 = prepvotstmt.executeQuery();
    rest3.next();
    String votecat = rest3.getString(1);
    while (rest3.next()) {
    out.print("category roles "+votecat);
    }then I get returned the following:
    admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admincategory roles admin
    like so.
    Where as at the DB level I get
    ROLE_NAME CC_ID
    admin 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    ops 1688
    risk 1688
    comply 1688
    legal 1688
    legal 1688
    ops 1688
    comply 1688
    Maybe the while should go around the getString(1) designation? But I was thinking I'd tried that and gotten invalid cursor error
    Something is definitely amiss, between the prepared statement in the servlet and the SELECT statement at the DB level.
    I can totally hardcode the statement in the servlet or JSP and it will return one value potentially several times, but only one.
    Other times, it will not return a value at all, even though one resides in the db.
    Yet go to the DB/SQL Plus prompt and it returns perfectly. I can simply copy and paste the SELECT statement from the out.print line I made and it works like a champ in SQL Plus. Any ideas why the same exact thing cannot return the proper values within the servlet/JSP?
    Yeeeeeeesh!!! : (
    Message was edited by:
    bpropes20

  • How to set multiple values in one context-attribute

    Hi all,
    Anybody knows a possibility to set multiple Values to a context-attribute?
    I know it how to get it with the following code:
    String break[]= request.getParameterValues("break");
    Now I want to do something like:
    request.setParameterValues(break[no]);
    where no is a counter in a loop.
    With the Method setAttribute(), I overwrite the previous inserted value.
    Thanx
    Robert

    I have not explizit declared break as an array.
    It is the Context- Attribute I want to send. I thaught that I can use it as an array in the same way I can do it when I send Data from an HTML- Form (with multiple values) to an servlet.
    I don't know how to declare the Attribute explizit as an array.
    that it is you wanted to know?
    I think my main problem is to get an array from the servlet to the jsp. Is there an other possibility (other than via Context-Attributes) to do that?
    thanx
    robert

  • How to create multiple links in one column

    Hi,
    Could someone please help me with creating 2 different links in one column as below.
    I enclosed is the screen shot of my current application view... I would like to put the link one below the other in one column instead in two different columns.
    Table Name - SR_PROCESS
    Functions - get_open_project , get_open_be
    Columns - ''Initiate New Project'' , ''Initiate New Bug or Enhancement''
    Below is my coding.
    select
    ''Initiate New Project'' AS "Initiate New Project" ,
    get_open_project("SR_PROCESS"."PROCESS_ID") "Open Projects",
    ''Initiate New Bug or Enhancement'' AS "Initiate New Bug" ,
    get_open_be("SR_PROCESS"."PROCESS_ID") "Open Bugs"
    from SR_PROCESS
    Thanks, Sheetal

    976745 wrote:
    Hi,Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "976745".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    Could someone please help me with creating 2 different links in one column as below.
    I enclosed is the screen shot of my current application view...Where is the screenshot? Providing an example on apex.oracle.com is a much better way to share details of your application.
    I would like to put the link one below the other in one column instead in two different columns.
    Table Name - SR_PROCESS
    Functions - get_open_project , get_open_be
    Columns - ''Initiate New Project'' , ''Initiate New Bug or Enhancement''
    Below is my coding.
    select
    ''Initiate New Project'' AS "Initiate New Project" ,
    get_open_project("SR_PROCESS"."PROCESS_ID") "Open Projects",
    ''Initiate New Bug or Enhancement'' AS "Initiate New Bug" ,
    get_open_be("SR_PROCESS"."PROCESS_ID") "Open Bugs"
    from SR_PROCESSDepends on your APEX version and the type of report. Please provide the information detailed above.

  • How to get Maximum value in one Column

    Here example
    I have table with one column named as "Title" i want the result as which data length in "Title" is more than 2.
    Title
    AAA
    A
    AAAAA
    AA
    i want result as :
    AAAAA
    AAA
    Thankx in Advance

    select title from <tab> where length(title) > 2;
    You could also use dump(title) to get the internal representation and length.
    Message was edited by:
    Stellios

  • How to retrieve value of one column to other in Apex using Javascript

    Hi all,
    Can any one help me in solving this problem.
    How to send a value from one column to another column using javascript in Apex. I heard that we can use onChange().
    My requirement is,
    I have a column(Varchar2) in form where i need to enter a value and the data need to be sent to another column(Number) when i press apply changes.
    ex: if i enter a value say 1/3 or 1/4 or 1/3*1/6
    the result should be entered in the other column.
    Message was edited by:
    Raman

    Try something like
    html_GetElement('P1_ITEM2').value = eval(html_GetElement('P1_ITEM1').value);

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How to get all the values in one column of a JTable

    How to get all the values in one column of a JTable as a Collection of String.
    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column.

    I don;t want to write a for loop to say getValueAt(row, 1) eg for 2nd column. You could always write a custom TableModel that stores the data in the format you want it. It would probably be about 50 lines of code. Or you could write a loop in 3 lines of code. I'll let you decide which approach you want to take.

  • How do you lookup multiple values in different columns based on variable criteria?

    Essentially, I'd like to be able to do a Vlookup but instead of searching for one value only, search for multiple values in separate columns. A smaller version of my current spreadsheet as an example...
    Attack Type ->
    Fire
    Water
    Grass
    Fire
    1/2x
    2x
    1/2x
    Water
    1/2x
    1/2x
    2x
    Grass
    2x
    1/2x
    1/2x
    Fire/Water
    1/4x
    1x
    1x
    Fire/Grass
    1x
    1x
    1/4x
    Grass/Water
    1x
    1/4x
    1x
    The headers are the attack types and the list of types to the left are the receiving Pokemon. Fire does half damage (1/2x) to fire types, Water does double damage (2x) to fire types, etc. I'd like to be able to search for specific damages for each type. For example, I'd like to find a Typing that recieves half (1/2x) damage from Fire-type attacks but also recieves double (2x) from Grass-type attacks. I do want more than just two search criteria though seeing as the actual table is much, much larger.
    I've tried assigning number values to each damage multiplier and then merging all of them together for a specific typing and doing a VLOOKUP based on checkboxes determining what damage multiplier I want in a few specific types, the rest being filled in to the standard of 1x but the result isn't correct most of the time.

    Hi Mitchell,
    VLOOKUP can be set for accept either an 'exact match' or a 'close match'.  Your 17 digit 'number' is actually a 17 character text string (Numbers can handle numbers to a precision of only 15 places). Provided all 17 digits are present, sorting should be the same as for numerical values—the leftmost character is the most significant.
    As a text string, your 'number' is sorted/evaluated alphabetically. A 'close match' accepts the 'largest value that is less than or equal to the search value'.
    If your search term is 000200000 (a 9 character string), several 'wrong' answers will fit the 'close match' criteria, including all of those listed below:
    000200000 (the 'correct' match)
    0000xxxxx (x may be any of the three acceptable values)
    0001xxxxx (x may be any of the three acceptable values)
    The main problem here is that digits in a number (or characters in a text string) have decreasing significance related to their distance from the beginning of the string/number. You want a search in which each character has the same significance as each of the others when compared to the search key. To do that, you need to compare each character in the search string with the character in the same position in the similar string for each type of Pokemon, then take a count of the matches or a sum of the differences.
    Here's one approach:
    Column A contains labels.
    Column B, the 17 digit search term, created in whatever manner you wish, and the similar 17 digit string for each of the characters.
    Columns C through S contains a formula that detines, using subtraction, the difference between each digit of the search term and the corresponding digit of each character's profile.
    Column C uses SUM() to calculate the total of columns C to S for each row.
    T1 uses =MIN(T) to calculate "least different" profile.
    Column A is a Header column; Row 1 is a Header row.
    Formulas:
    C2, and filled right to S2, then down to the last row of data:
    =ABS(MID($B$1,COLUMN()-2,1)-MID($B2,COLUMN()-2,1))
    T1: =MIN(T)
    T2, and filled down column T: =SUM(C2:S2)
    The conditional formatting rule set for all body cells in column T is shown below the table.
    This may be enough to get you started. Formulas can be tweaked to produce results more closely matching what you're looking for, if necessary.
    Regards,
    Barry

  • How to use multiple values in an IF condition in RTF

    Hi,
    I have a scenario as mentioned below.
    IF column value in ('A','B')
    display C;
    end if
    IF column value not in ('A','B')
    display D;
    end if
    My query is how to provide multiple values in an IF condition.?
    Thanks,
    Anand

    But suppose "x.jar" needs a library from "y.jar". How do you put another JAR on the classpath of an applet in a Web page?
    <applet code="z.class" archive="a.jar,b.jar,c.jar">

  • How to pass multiple values from workbook to planning function ?

    Hi,
    I have created Planning function in Modeler and it has one parameter(Variable represents = Multiple single values).
    When executing the planning function by create planning seq. in the web template : I see value of variable store data like ...
        A.) input one value -> V1
        B.) input three values -> V1;V2;V3
    This function execute completely in web.
    However, I want to use the planning function in workbook(Excel).
    The value of variable can't input V1;V2;V3... I don't know how to pass multiple values from workbook to parameter(Multiple single values type) in planning function ?
    thank you.

    Hi,
    Please see the attached how to document (page no 16).
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be">how to</a>
    Hope this was helpful
    thanks

  • How to get multiple values using HttpSession.getAttribute(java.lang.String)

    Hey Guys
    I'm trying to find a way to get multiple values using the following method
    HttpSession.getAttribute(java.lang.String)
    Here's the scenerio. Its a already written application and now i'm trying to make some changes. earlier in the jsp page a combo box was used and value was retrieved in the servlet using the getAttribute method of Session. Now I'm using a html multiple selection list and have to retrieve all the values selected in the list in the servlet. Can anyone please suggest me how to do that. HTTPRequest class has a method getParameterValues which will let me do that but i have to do is using HTTPSession.
    Thanks for your time to read this

    I'm not sure what you are trying to do. You can only use session.getAttribute to retrieve something that has already been stored in the session with a previous setAttribute. If you need to store multiple values under one attribute name using setAttribute, you can store an array, or an ArrayList or whatever type of Collection you want. The request.getParameterValues method is the only way you can retrieve form parameters than can have multiple values. If the servlet hasn't already processed these parameters and put them into the session for you, you have to use request.getParameterValues.

  • How to select multiple values from the parameters in BI Publisher report

    How to select multiple values from the parameter drop down in BI Publisher, and how to handle this mulitple values from the report sql...

    Hi kishore,
    I have used all the steps as you mentioned in your previous reply....including checking Mulitple Selection Check Box..
    Iam able to get the results when I am selecting one value..
    and also I am able to handle multiple values the in the query by using IN :Parameter, but seems when we select more than one value from the parameter drop down i think the Bi Publisher is sending the values in concatenated form something ilke
    ex: "'ACCOUNT','HR','SALES'" ,and when trying to display the parameters values in the output, its throwing the error as 'missing right paranthesis' ....on the whole do you have any solution which would handle
    1.Single selection.
    2.Multiple selection.
    3.'ALL' Values.
    4.Separating the concatenated string into individual strings and dispaly them on the output of the report..etc..in case of Mulitple selection.
    Ex:
    Concatenated String from BI Publisher:"'ACCOUNT','HR','SALES'"
    Expected Output on the report:ACCOUNT,HR,SALES
    reply to this would be much appreciated....
    thanks,
    manoj

  • How to execute multiple queries in one stored procedure.

    Hi,
    I am Kumar,
    How to execute multiple queries in one stored procedure.
    here is the my requirements,
    1. get the max value from one table and sum of the that value.
    2. insert the values and also sum of the max value.
    using stored procedure
    I am using SQL server 2000 database.
    Please help me.
    Advance thanks
    by,
    Kumar

    This is not a java question and it is not even a problem: your only problem is
    1) lack of knowledge
    2) lack of interest to find a manual
    But you are going to have to change both by actually reading a book or a manual that explains the stored procedure language of SQL Server. It is the same as Sybase I think, so you could also look for a manual for that DBMS.

Maybe you are looking for

  • Can I stream content on AirPort Extreme to Apple TV?

    Hello, I am considering purchasing a AirPort Extreme.  I am wondering if I can stream the content saved on the hard drive through Apple TV? Thanks.

  • Cost assignment-Multiple cost objects being selected by default from the EP

    Hi, I have created an expense report from the Portal and entered the cost object - a WBS element and saved the report. Now, when I check in table: PTRV_SCOS, it shows me the cost object assigned are - both - the WBS Element as well as the Cost center

  • WCS annual support: what do I get for extra AP license packs?

    I am not trying to be snide here, but I am having a difficult time understanding what new value I get for an extra SAU annual support package that my Cisco Partner says I now need, since I added additional AP licenses to the WCS software. This add-on

  • New nano's & Polar Wearlink+

    Will the new nano's still be compatible with the polar wearlink+ chest strap that's being sold through the Apple online Store? I just bought a new strap and am itching to get a new nano (so I don't have to worry about losing the dongle any longer ;-)

  • Where do i go to authorize another computer?

    I cannot find where to authorize a computer on my account. The help from itunes is not helping either. It says go to the store menu and click authorize this computer but when i go to the store menu it's no where to be found. Maybe  i'm doing this wro