help plz


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 3 123 LastLast
Results 1 to 15 of 32

Thread: help plz

  1. #1
    Join Date
    Dec 2008
    Posts
    27

    help plz

    Relational Algebra Help SQL
    I have the following table :

    Patient (PatientCode, PatientSurname, PatientFirstname, PatientSex, Age, PatientOccupation, PatientHeight, PatientWeight, PatientAddress)

    Doctor (DoctorCode, DoctorSurName, DoctorFirstName, DoctorPrivateAddress, MobileNo, Function)

    Operation (Operation Code, PatientCode, DoctorCode, Date, Time, Result, OperationType)

    Is_Seen_By (PatientCode, DoctorCode, Date, Time).


    2 - i need in relational algebra form 2 find :

    1. Find the surname and gender of the patients that have been operated on by doctor "DR20" and results have been successful.
    2. Find the code of the operations that have been done on the 15th of December of 2008 and have been successful.
    3. Find the first name, surnames and address of the patients that have had at least one operation with broken limb.
    4. Find the details of all patients that have shared any doctors with the patient that has the code P555".
    5. Find the surname, gender and age of the patients that have been seen by doctor "DR55" and have been operated on by doctor DR9.


    **** for the first one i have came up with : -

    R1: select doctor where doctor code ="DR20"
    R2: R1 NAT JOIN Patient
    R3: Project R2 over patientsurname, patientsex

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    I do not understand what algebra has to do with any of this?

    I gather you are looking for the syntax for the SQL queries that will return the results asked for in 2, 3, 4 and 5, right?

    What have you tried to these that isn't working for you?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Dec 2008
    Posts
    27
    hi thanks for your reply. it is an assignment and for some reason we have to provide the relational algebra for the questions listed. i just reqyire some help and wonder if my 1st one is right?

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    To me it looks like nothing more than a SELECT query with a couple of INNER JOINS and you will have the results asked for. Not all of then even require joins.

    For instance, #2
    Code:
    'Find the code of the operations that have been done on the 15th 
    'of December of 2008 and have been successful
    
    SELECT [operation code], [operation type] FROM operation
    WHERE [date] = '12/15/2008' 
    AND result = 'success'
    Where is the math in that?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Dec 2008
    Posts
    27
    could you possibly help me with the other ones especuially ones that do require algebra of that type? it would be greatly appreciated

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    None of them require algebra.

    In fact, none of them require 1st grade arithmetic.

    They all require SQL SELECT queries.

    I'm not going to write them for you, but I'll give you a hand in writing them for yourself.

    How do you think the query for #3 should be written?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  7. #7
    Join Date
    Dec 2008
    Posts
    27
    thanks for your help, but im still stuck. it stipulates on my worksheet write the queries listed in relational algebra only

  8. #8
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Is relational algebra some kind of programming language?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  9. #9
    Join Date
    Dec 2008
    Posts
    27
    no it is algebra used in sql. it used the layout like r1: r2: etc as on my 1st attempt. and there are thing such as nat join etc.

  10. #10
    Join Date
    Dec 2008
    Posts
    27

  11. #11
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    In darn near 30 years of programming, much of which was spent, and continues to be spent, with database development and SQL, this is the first time I've ever heard of this.

    I have no idea what practical use this would be in the real world, but I do wish you all the luck.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  12. #12
    Join Date
    Dec 2008
    Posts
    27
    ok how about in nroml sql query language performing the ollwing :

    find surnmae of patients that have been seen by at least one of the doctors that have seen patient "p44"

  13. #13
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Probably have to play with it a little bit, but off the top of my head I'd start with something like
    Code:
    SELECT pat.patientsurname, pat.patientcode, seen.doctorcode 
    FROM patient pat
    INNER JOIN is_seen_by seen ON seen.patientcode = pat.patientcode
    INNER JOIN doctor doc ON doc.doctorcode = seen.doctorcode
    WHERE pat.patientcode = ‘p44’
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  14. #14
    Join Date
    Dec 2008
    Posts
    27
    how would i write this one in sql ?

    Find the name, gender and age of the patients that had an operation on the 21st of November 2008. List the surname of all doctors that were involved.

  15. #15
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Give it a stab on your own and see what you can come up with..
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 26
    Last Post: 12-01-2012, 04:12 AM
  2. Plz help im very new to this
    By Hellverine in forum .NET
    Replies: 8
    Last Post: 04-25-2007, 03:16 PM
  3. Plz Urgent!! Its really essential
    By mr06 in forum .NET
    Replies: 2
    Last Post: 06-22-2006, 12:12 PM
  4. plz plz plz help me(java)
    By kamon in forum Java
    Replies: 4
    Last Post: 08-10-2005, 10:30 AM
  5. java applet... i'm in a fix, plz help
    By nsbscool in forum Java
    Replies: 1
    Last Post: 05-02-2005, 08:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center