HOW to handle a situation where 3 tables have on to many relationship with one single table?

Hi fellows!
i have three tables named
Teacher_T(UserName, Pwd, Phone, Email, Experience, Academics) //here UserName is the PK
Student_T(UserName, Pwd, Phone, Email) //here UserName is the PK
Ad_T(UserName, Title, Description) //here UserName is the FK
i want to enable both the teacher and the student to post their ads and in the Ad_T table ... for which i have created 2 relationships in Ad_T table:
1) among Ad_T and Teacher_T using the UserName of Teacher_T as FK in Ad_T
2) among Ad_T and Student_T using the UserName of Student_T as FK in Ad_T
but this would not work as FK constraint requires that the value must be corresponding to a row in the PK table and problem here is that i am having two PK tables instead of one ... 
one way to solve this problem is to create two separate tables         1) Student_Ad_T           2)Teacher_Ad_T         but i dont want to do so .......
Any suggestions? 
farooq.hnf

Try:
CREATE TABLE Teacher_T(UserName varchar(30) PRIMARY KEY, Pwd varchar(30),
Phone varchar(30), Email varchar(30), Experience varchar(30), Academics varchar(30));
CREATE TABLE Student_T(UserName varchar(30) PRIMARY KEY, Pwd varchar(30), Phone varchar(30), Email varchar(30))
CREATE TABLE Ad_T(UserNameT varchar(30) NULL REFERENCES Teacher_T,
UserNameS varchar(30) NULL REFERENCES Student_T, Title varchar(30), Description varchar(30))
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Similar Messages

  • How to handle the situation to forward work item manually?

    Hi All,
    In my workflow -
    For agent determination I have some custom logic to determine agents. If custom logic donu2019t return any agents then the requirement is work item needs to send back to workflow initiator.
    My issue-
    When no agent determines
    1.Work item needs to send back to workflow initiator - and he should not able to Approve or Reject work item - He Can only forward work item to any other person manually (he determines to whom it should forward).
    2. After manually forwarding the work item it is normal process 2 level of approval from that point .
    Please let me know for the first item how to handle the situation?
    I have developed 2 section - one goes with regular agent determination -
    and the other one when no agent determines then I am assigning back to workflow initiator. Now I want to handle that - initiator should not accept or reject and he can only forward to someone. How to develop this?
    Please let me know your thoughts.
    Thanks in advance.
    Rajesh,

    Hi All,
    Thanks for the answers.. sorry for late replay.. requirement was not confirmed.
    1. As I described in my question
    After my custom conditions.. I have to send workitem back to initator ( Now initiator forwards the work item to someone else  ( need to restrict  users  based on role - )..
    While doing this process initiator should not have access to approve or reject he should only forward the workitem.
    After forwarding the work item -this person should have approve or reject options.
    My question is not answered..
    1. As Vijay told..
    Dont give Approve and Reject Options and in Description u specify like
    If I dont provide approve/reject when I am sending the work item to initiator - After initiator forwarding this work item - how do we the other approver will get options  Approve and Reject?
    2.  AS -surjith kumar
    If your Using the Rule or Expression you have to restrict via coding -  This will solve one of my problem -
    How I can restict  users with role based?
    My problem is not solved.. Initiator should not have access to approve but He should only forward the work item...
    Please let me know...

  • How do you have multiple apple id's with one itunes

    how do you have multiple apple id's with one itunes

    I have multiple IDs and use the single computer sharing itunes. By 'sharing' I mean we open the pc, open itunes and log in with our individual ID as required.
    While Im logged in I plug in  my device. I transfer my purchases from my device as per the file menu (not the check for auto downloads). I move them as required to whichever playlist I like.
    Then when my son wants to use itunes or update his device, he logs in, plugs in his device, transfers purchases from his device, puts whatever music he wants into his playlist and/or drags direct to the device regardless of who purchased it and then syncs.
    Im not sure how it works associating the pc with only one ID or all that other business- I know I don't fiddle with any of that.

  • What type of movie clips are handled by the ipad? I have shot a movie clip with my canon camera and the file is .AVI.  will this load onto ipad?

    what type of movie clips are handled by the ipad? I have shot a movie clip with my canon camera and the file is .AVI.  will this load onto ipad?

    Per http://www.apple.com/ipad/specs/
    AirPlay Mirroring to Apple TV (2nd and 3rd generation) at 720p
    AirPlay video streaming to Apple TV (3rd generation) at up to 1080p and Apple TV (2nd generation) at up to 720p
    Video mirroring and video out support: Up to 1080p with Apple Digital AV Adapter or Apple VGA Adapter (adapters sold separately)
    Video out support at 576i and 480i with Apple Composite AV Cable (cable sold separately)
    Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

  • How to handle error for a Db Table to Db table transform in ODI

    Hi,
    I have created two table in two different schema source and target, where there is a field for e.g.- place where the datatype is varchar2 and data inserted is string.
    In designer model of ODI i have put the type of place as number in both source and target and accordingly done the mapping.
    When it is executed it should give an error, but it got completed but no data is inserted neither in target table nor in error table in the target schema(E$_TARGET_TEST which is created automatically).
    Why the error is not given and how to handle such type of error..
    Please help.
    The codes for source and target tables are as follows:
    source table code:
    CREATE TABLE "DEF"."SOURCE_TEST"
        "EMP_ID"   NUMBER(9,0),
        "EMP_NAME" VARCHAR2(20 BYTE),
        "SAL"      NUMBER(9,0),
        "PLACE"    VARCHAR2(10 BYTE),
        PRIMARY KEY ("EMP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE
    inserted data:
    INSERT INTO "DEF"."SOURCE_TEST" (EMP_ID, EMP_NAME, SAL, PLACE) VALUES ('1', 'ani', '12000', 'kol')
    INSERT INTO "DEF"."SOURCE_TEST" (EMP_ID, EMP_NAME, SAL, PLACE) VALUES ('2', 'priya', '15000', 'jad')
    target table code:
    CREATE TABLE "ABC"."TARGET_TEST"
        "EMP_ID"     NUMBER(9,0),
        "EMP_NAME"   VARCHAR2(20 BYTE),
        "YEARLY_SAL" NUMBER(9,0),
        "BONUS"      NUMBER(9,0),
        "PLACE"      VARCHAR2(10 BYTE),
        PRIMARY KEY ("EMP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE

    Hi,
    I have used the following KMs in my transformation with the following options:
    IKM SQL Incremental Update
    INSERT    <Default>:true
    UPDATE    <Default>:true
    COMMIT    <Default>:true
    SYNC_JRN_DELETE    <Default>:true
    FLOW_CONTROL    <Default>:true
    RECYCLE_ERRORS    <Default>:false
    STATIC_CONTROL    <Default>:false
    TRUNCATE    <Default>:false
    DELETE_ALL    <Default>:false
    CREATE_TARG_TABLE    <Default>:false
    DELETE_TEMPORARY_OBJECTS     <Default>:true
    LKM SQL to SQL
    DELETE_TEMPORARY_OBJECTS    <Default>:true
    CKM Oracle
    DROP_ERROR_TABLE    <Default>:false
    DROP_CHECK_TABLE    <Default>:false
    CREATE_ERROR_INDEX    <Default>:true
    COMPATIBLE    <Default>:9
    VALIDATE    <Default>:false
    ENABLE_EDITION_SUPPORT    <Default>:false
    UPGRADE_ERROR_TABLE    true

  • How to handle double click in a table control?

    Hi,
    Can any one let me how to handle double click event in a table control in dialog programming?
    here i need to navigate to another screen when user double click on the table contols (emp number column).
    thanks in advance,
    PrasadBabu.

    to define double click in your table controlwhich is similar to 'PICK' function. Enable F2 in PF-status for this
    Table Control Question
    Check the above thread which was posted recently on SDN, please award points if found helpful

  • Have started to get  info window from iTune telling "This computer is already associated with an Apple ID. "You can download past purchases on this computer with just one Apple ID every 90 days......" How to handle this situation

    "You can download past purchases on this computer with just one Apple ID every 90 days. This computer can be used with a different Apple ID in 63 days." How to handle this situation

    https://discussions.apple.com/message/16567363#16567363
    From the  More Like This  section on the right

  • HT2534 Many devices with one apple ID between husband and wife....HOW!?

    So, when my wife and I are both using separate iPads, how do we NOT get all these messages intended for the other person? One Apple ID for .... four products (Each have an ipad and ipod) makes it hectic enough. Now it's a nightmare figuring what to do. went into settings and changed HER imessages to her email address and I'm not getting anything and she's getting all of them. SO, now my devices won't recieve imessages etc. etc.
    Hope someon knows how to do this so I don't have to purchase a whole lot of more itunes crap again just because I'm not smart enough to figure out how to use a different apple id and keep my music.
    Oh, and that's it, the music and apps. We couldn't care less about most of the apps since I'm the only one BUYING them and she uses almost all free ones, but the MUSIC IS ALL ON ITUNES! Do I need to backup the entire library onto a bunch of disks and then "relicense" them from myself? How much work could THAT possibly be worth? Gotta be a simple solution. Never had so many apple products and these are my wife's first.
    HELP!!!!!!!!!!

    We're screwwwwwed! Not THAT familiar to apple, just barely plugging along and dove in with two ipads and two ipod touches. Previous experience was just two ipods (160 GB) that I had to still rotate audio books out of every few months... well, for me. My wife doesn't use hers as much. ANYWAY, I lost a zillion things with the ipod classic since it didn't have a back-up option and many of the CDs I scrounged up when it first came out were already lucky to have survived college. 8 years later and the computer that had the original files had been replaced umpteen times. ipods failed and decided to quit being a tight wad. Not sure if these gifts are worth it yet.... well, two of them were.

  • HT2486 How can I send an email to all of the email addresses associated with one contact? Similarly, in regard to group lists, how do you include for distribution all email addresses associated with each contact in the group?

    Often times there are multiple email addresses associated with a single contact in address book.  How can I included all of these email addresses when creating an address book group?

    Don't be surprised.
    Apple offers free, basic Mail and Address Book apps and creates paid, more sophisticated solutions, also allowing Developers to provide more sophisticated solutions for sale in the marketplace.
    When I need to repeatedly email to multiple contacts, I create a blank draft email, and use the Address Book button to list the appropriate address book group. With the Address Book window open, it's easy to click to add multiple email addresses for a single contact name. Each is added to the message email address list. Then I save that blank email to iCloud Drafts, and it retains the email addreses I've entered. Next time I need to send a message I double-click on it in Drafts to open it, and drag it to one of my other email accounts to add Subject and details, then send from the other account.
    Message was edited by: kostby

  • The font size in the menu bar is too small (unreadable). How can I increase font size. I have a new Samsung PC with high resolution screen.

    Hi the fnt size in the menu bar is too small (unreadable). How can I increase the font size. I have a new Samsung PC with high resolution screen.

    You must mean Photoshop Elements 11, not Photoshop.
    There is no ability to change the size of the menu font in PSE 11.
    note to mod:
    Please move to the Photoshop Elements forum.

  • How do I reinstall Export PDF?  I have a new PC (the previous one expired!).  I have a yearly renewing contract.

    HI,
    I have a new PC; the old one having expired.  I have a yearly renewing contract on this product - how do I go about installing on the new machine please?

    Thank you
    John Keegan OBE
    07931 593621
    >

  • Explain about how oracle handles Simultaneous insertions to a table

    Hi,
    Pls help me out ok..
    How does oracle handle this senario....explained below?
    When 2 users insert to a same table at the same time who gets into the table first?User 1 or user 2?
    then.......
    In a table where the auto number is generated user 1 adds 10 records.Doesn't commit it.So the 10 records r visible to his/her session.Another User user 2 doesnt see this change in his/her session.
    User 2 wants to get the max number of records in the same table and he does a count.What will this user get as the count?
    (If the table was empty before the user 1 added 10 records.)How does Oracle handle this scenario?
    Kaushi

    Dear Kaushi,
    It's very simple,
    When ever 2 or more users work on oracle database the concept of LOCKS applies
    There are 2 types of locks:
    a. Exclusive Lock.
    b. Public Lock.
    as per your question the when user one will be submitting the data on a table and the user 2 will find that database in exclusive lock. Thus he can only view(select)
    the records but he can not append/insert any row in that table.
    Thus there is no question of error.
    Hope you got ur answer.
    varun
    (IBM certified software engineer)

  • How to handle paging in a databinded table

    hi
    i just builded a table which is filled by an executequery situated in my VO.
    my rows are displayed 10 by 10. when i click on the next button, the rows displayed stay the same. They are not refreshed.
    how can i display the next rows of my query ?
    thx
    Dan

    in my table i have 2 objets :
    1 item (messagestyledtext) which is binded to a varchar2 column. i filed 2 properties, view instance with the right VO, view attribute with the column name details.
    evrything is working well when this column is on his own or when i have 2 items binded to 2 columns.
    the second item i have is a switcher : the only properties i modified are view instance ( with the same VO than the up item) and view attribute binded to a column which returns W or E.
    the switcher has 2 children case. each case has an item image. one image is named W and the other one is named E. i modified only one property for each image item : image URI :
    _i added FNDWARNS.gif for the W image,
    _i added FNDERROR.gif for the E image.
    did i forget something ?
    thx
    Dan

  • How to handle multi row update in table?!

    Hello,
    I am searching for a solution to edit/update a lot of rows of a table at one time. The user has the ability to edit all cells of this table and then update this by pressing a submit button.
    I have a managed bean with an collection of objects. Each object represents on row.
    How is this handled in JSF? Is it only necessary to bind the datatable to the collection?
    Thanks,
    Thomas

    Is it only necessary to
    bind the datatable to the collection?Yes.
    Don't forget to put the collection in session scope.

  • How to handle Lov event from Advanced Table

    hi all,
    I have requirement like I need to return 5 items from lov RN and need to bind them with curresponding 5 coloumns in advanced table which is diplaying fine,
    but once clicked on 'Add New Row' button values from the privious row is getting null/disappearing. All the items in advanced table are binded with proper view Attribute.
    Please let me know why it is behaving so? and kindly give the solution also how can I handle this.

    Hi,
    The columns on which you are returning the values must be messageStyledTexts Right??
    If yes, then you should know that read only fields are not able to hold values and hence the lov mappings gets lost when you click on Add New Row button.
    To avoid this.
    For 5 columns, create 5 form Values and bind the same View Attribute to them as to the columns.
    Now in the LOV also create 5 mappings for form values same as you have created for table columns.
    This way it should work.
    Thanks,
    Gaurav

Maybe you are looking for

  • Issue with F4 help for the variables for the 0CALWEEK and 0CALMONTH

    We have custom IOs which refers to 0CALWEEK and 0CALMONTH.In the report we have variables on the custom IOs.For these variables F4 help does not giving any values .I tested with  0CALWEEK also. For the 0CALWEEK also F4 help does not working..Please h

  • Confusion in Order of row and statement level trigger

    Hi can anyone tell me, if i create some trigger on table emp as in below order.. BEFORE INSERT .. ROW LEVEL BEFORE INSERT .. STMNT LEVEL AFTER INSERT .. ROW LEVEL AFTER INSERT .. STMNT LEVEL than what will will be order of execution of trigers? How o

  • [svn:osmf:] 10711: Adding missing reference to the VAST library.

    Revision: 10711 Author:   [email protected] Date:     2009-09-29 21:38:56 -0700 (Tue, 29 Sep 2009) Log Message: Adding missing reference to the VAST library. Modified Paths:     osmf/trunk/framework/MediaFrameworkAirTest/.actionScriptProperties

  • Existing video files won't import into Lightroom 4.1

    I have several hundred videos I have taken, either with a Canon SD800, Canon S95, Canon T2i or a GoPro. New videos I take on this equipment works just fine when adding to Lightroom. But when I try to import older files, I get error: video file not im

  • Jdbc version

    is there a way i can programatically determine whether the driver i am using is jdbc 2.0 compliant?