+ Reply to Thread
Page 4 of 4 FirstFirst ... 2 3 4
Results 61 to 72 of 72

Thread: SQL Help     submit to reddit submit to twitter

  1. #61
    Black Belt
    Join Date
    Aug 2005
    Posts
    5,907
    BG Level
    8
    FFXI Server
    Quetzalcoatl

    I believe you need to use the
    CONSTRAINT <primary key name> primary key (key1, key2, key3)
    command in oracle. It's different depending on what you use to make your database in, but I see from the screenshot you're using oracle.

  2. #62
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Uzor View Post
    I believe you need to use the
    CONSTRAINT <primary key name> primary key (key1, key2, key3)
    command in oracle. It's different depending on what you use to make your database in, but I see from the screenshot you're using oracle.
    CREATE TABLE WorksOn
    ( empNo NUMBER(6) NOT NULL,
    projNo NUMBER(4) NOT NULL,
    dateWorked Date,
    hoursWorked NUMBER(3) NOT NULL,
    CONSTRAINT WorksOnBLF_FK
    PRIMARY KEY(empNo, projNo, dateWorked)
    );

    Populated but looks like it rounded all the numbers up/down :/

    Spoiler: show

    EMPNO PROJNO DATEWORKED HOURSWORKED
    ---------- ---------- ---------- -----------
    585049 1336 22-FEB-13 3
    392899 1905 22-FEB-13 8
    346278 2485 26-FEB-13 5
    352495 4599 27-FEB-13 3
    360138 4982 01-MAR-13 5
    579977 3120 02-MAR-13 9
    745164 8076 06-MAR-13 1
    662608 3120 17-MAR-13 0
    360138 4982 17-MAR-13 2
    182880 3120 26-MAR-13 2
    579977 6693 28-MAR-13 5
    745164 4599 01-APR-13 4
    128861 4918 01-APR-13 4
    585049 1838 10-APR-13 8
    742541 1905 10-APR-13 6
    392899 2317 10-APR-13 7
    948201 2405 10-APR-13 8
    547272 1336 11-APR-13 4
    533455 1905 11-APR-13 7
    485284 4599 14-APR-13 7
    117655 2007 17-APR-13 1
    585049 1336 19-APR-13 8
    392899 3012 19-APR-13 8
    579977 3120 19-APR-13 5
    349024 1336 24-APR-13 2
    394200 1905 24-APR-13 2
    943346 6693 29-APR-13 5
    906728 6444 02-MAY-13 5
    742541 2403 03-MAY-13 5
    490577 2007 10-MAY-13 0
    536988 1838 11-MAY-13 5
    640224 3012 11-MAY-13 7
    182880 3120 13-MAY-13 3
    650590 4918 13-MAY-13 1
    906728 2405 14-MAY-13 2
    650590 4982 16-MAY-13 9
    422712 1336 28-MAY-13 0
    742541 2317 28-MAY-13 5
    128861 4982 28-MAY-13 3
    369042 8076 28-MAY-13 2
    943346 3120 31-MAY-13 3
    650590 2485 02-JUN-13 3
    640224 3012 02-JUN-13 2
    547272 1336 05-JUN-13 5
    392899 1905 05-JUN-13 5
    503581 2407 11-JUN-13 2
    221223 4567 11-JUN-13 8
    394200 7002 15-JUN-13 1
    925206 1336 19-JUN-13 7
    742541 2317 19-JUN-13 6
    943346 3120 22-JUN-13 2
    939206 3120 24-JUN-13 7
    503581 4567 26-JUN-13 7
    650590 2485 28-JUN-13 3
    165553 2485 30-JUN-13 4
    342561 1991 14-JUL-13 8
    585049 1336 15-JUL-13 8
    394200 3012 15-JUL-13 7
    349024 1838 19-JUL-13 6
    394200 2403 19-JUL-13 3
    745164 4599 19-JUL-13 3
    394200 1905 23-JUL-13 7
    171562 4986 23-JUL-13 0
    346278 2485 24-JUL-13 2
    360138 2485 24-JUL-13 6
    128861 4289 25-JUL-13 1
    206298 2407 26-JUL-13 6
    171562 4982 27-JUL-13 8
    269749 3120 28-JUL-13 5
    939206 3120 28-JUL-13 2
    585049 1336 31-JUL-13 4
    394200 7002 31-JUL-13 5
    588966 4982 03-AUG-13 6
    848115 4567 04-AUG-13 2
    745164 2405 05-AUG-13 2
    809804 4567 05-AUG-13 2
    182880 6693 07-AUG-13 8
    349024 1838 10-AUG-13 6
    640224 1905 10-AUG-13 8
    538609 2485 14-AUG-13 5
    277042 4567 14-AUG-13 4
    617417 4918 14-AUG-13 5
    585049 1336 15-AUG-13 6
    392899 1905 15-AUG-13 6
    360138 2485 21-AUG-13 7
    360138 4986 21-AUG-13 2
    943346 1991 25-AUG-13 6
    948201 2405 01-SEP-13 8
    843818 2407 09-SEP-13 8
    547272 1838 12-SEP-13 4
    533455 1905 12-SEP-13 2
    742541 3012 20-SEP-13 3
    585049 1838 23-SEP-13 7
    640224 1905 23-SEP-13 4
    433775 2007 24-SEP-13 2
    538609 2485 04-OCT-13 0
    198252 2407 06-OCT-13 5
    617417 2485 08-OCT-13 6
    948201 8076 08-OCT-13 1
    271957 2007 09-OCT-13 6
    809804 2007 09-OCT-13 8
    360138 4986 11-OCT-13 3
    939206 1991 12-OCT-13 0
    547272 1838 15-OCT-13 1
    360138 4289 15-OCT-13 4
    640224 7002 15-OCT-13 6
    394200 1905 17-OCT-13 1
    392899 1905 18-OCT-13 3
    462463 1991 24-OCT-13 5
    360138 4918 24-OCT-13 0
    588966 4918 31-OCT-13 5
    369042 8076 31-OCT-13 1
    128861 2485 03-NOV-13 3
    128861 4918 03-NOV-13 7
    342561 6693 05-NOV-13 8
    269749 6693 15-NOV-13 6
    422712 1336 16-NOV-13 2
    742541 1905 16-NOV-13 7
    462463 6693 17-NOV-13 1
    943346 1991 18-NOV-13 9
    206298 4567 19-NOV-13 7
    906728 6444 20-NOV-13 1
    906728 2405 21-NOV-13 1
    269749 1991 24-NOV-13 8
    269749 3120 25-NOV-13 7
    485284 4599 26-NOV-13 2
    198252 4567 30-NOV-13 2
    422712 1838 01-DEC-13 2
    742541 3012 01-DEC-13 6
    538609 4289 05-DEC-13 0
    433775 2007 06-DEC-13 6
    422712 1838 07-DEC-13 6
    392899 2403 07-DEC-13 7
    182880 1991 08-DEC-13 6
    352495 2405 08-DEC-13 4
    360138 4918 09-DEC-13 7
    640224 1905 10-DEC-13 8
    650590 4982 16-DEC-13 6
    485284 4599 21-DEC-13 7
    485284 2405 23-DEC-13 6
    589559 2007 05-JAN-14 3
    939206 6693 05-JAN-14 6
    588966 4986 06-JAN-14 1
    349024 1336 12-JAN-14 3
    394200 7002 12-JAN-14 3
    742541 1905 13-JAN-14 3
    269749 6693 13-JAN-14 3
    589559 4567 14-JAN-14 1
    490577 2007 19-JAN-14 4
    579977 3120 23-JAN-14 7
    547272 1838 03-FEB-14 2
    394200 1905 03-FEB-14 8
    617417 4289 05-FEB-14 2
    269749 3120 06-FEB-14 7
    226827 6444 08-FEB-14 4
    171562 2485 10-FEB-14 5
    538609 2485 10-FEB-14 8
    117655 2007 12-FEB-14 1
    182880 6693 12-FEB-14 7
    422712 1838 14-FEB-14 6
    392899 3012 14-FEB-14 6
    547272 1336 20-FEB-14 8
    650590 4982 20-FEB-14 2
    392899 7002 20-FEB-14 8

    164 rows selected



    EDIT: NVM fixed by changing number(3) to number(3,2)

  3. #63
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Woot all data populated lol!

    Now to do the sql! If anyone has the time please look at the questions and my answers and see if you can find any holes in the logic or why it will give me wrong answers



    Tables:
    DepartmentBLF {deptNo, deptName, mgrEmpNo}

    EmployeeBLF { empNo, fName, lName, address, dob, sex, position, deptNo}

    ProjectBLF { projNo, projName, deptNo }

    WorksOnBLF { empNo, projNo, dateWorked, HoursWorked }


    NUMBER 1

    SELECT d.deptName, COUNT(*) AS Total,
    SUM(CASE WHEN e.sex = 'F' THEN 1 ELSE 0 END) AS Male,
    SUM(CASE WHEN e.sex = 'M' THEN 1 ELSE 0 END) AS Female
    FROM employeeBLF e NATURAL JOIN departmentBLF d
    GROUP BY d.deptName
    ORDER BY total

    Answers half the question. Not sure how to get the sub total line at the bottom or how to re arrange like the example provides

    NUMBER 2:

    SELECT d.deptNo, d.deptName, e.deptNo, e.empNo, e.fName, e.lName
    FROM DepartmentBLF d LEFT OUTER JOIN (SELECT *
    FROM EmployeeBLF
    WHERE position = 'Secretary') e
    ON(d.deptNo = e.deptNo)
    ORDER BY d.deptNo ASC

    NUMBER 3:

    SELECT deptName, empNo, fName, lName, position
    FROM DepartmentBLF d CROSS JOIN EmployeeBLF e
    WHERE d.mgrEmpNo = e.empNo
    ORDER BY DeptName;

    NUMBER 4:

    SELECT empNo, fName ||' '|| lName NAME, deptName
    FROM DepartmentBLF NATURAL JOIN
    (SELECT *
    FROM EmployeeBLF NATURAL JOIN WorksOnBLF
    WHERE HoursWorked <=1)
    ORDER BY deptName, lname

  4. #64
    Black Belt
    Join Date
    Aug 2005
    Posts
    5,907
    BG Level
    8
    FFXI Server
    Quetzalcoatl

    I have to head to bed, but I'd recommend you to read up on CREATE VIEW for that. It should do what you need if I understood the questions correctly.

  5. #65
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Quote Originally Posted by Uzor View Post
    I have to head to bed, but I'd recommend you to read up on CREATE VIEW for that. It should do what you need if I understood the questions correctly.
    There was a question like it on the Second home work. I've been trying to adapt that but so far no luck >< been workin on this crap for past 4 hours though so gonna take a break for the night Thanks for all your help

  6. #66
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Ok big test tomorrow that will make or break me. Would anyone mind explaining 1st 2nd 3ed normal forms to me? I'm totally lost on them and everything I read only confuses me more or doesn't provide examples.

  7. #67

    I'm just going to piggy back off this thread, since its in the same vein as the OP.

    I'm a biologist thrust into new responsibilities of being an Oracle DBA as well. I've been requested to run a query to extract some meta data. Problem is one of the fields is a BLOB, which I can "view" the contents in hex binary. Problem is, I'm not sure what type of file they went into the field as (jpg, gif, some other format). Is there an easy way to figure that out or to write them out to disk somewhere?

    From all my googling, it doesn't make sense that they would store the files directly in the DB, rather just store the path. I'm at loss here and any help would be appreciated!

    I also looked through procedures and packages to see if there was already something set up to do just what I'm looking for, and having no luck.

  8. #68

    You actually will have to write out the contents to figure out what the blob is.

    BUT, better yet, just ask someone who knows the schema? I'm assuming there is no documentation that you can just look up.

  9. #69
    Salvage Bans
    Join Date
    Jun 2011
    Posts
    927
    BG Level
    5
    FFXI Server
    Sylph

    Ok doing a big case study. I have to make the functional dependencies. This is what my Partner Sent me:

    Spoiler: show


    StaffMember(staffNo, fName, lName, address, phone, DOB, gender)

    Patient(patientNo, fName, lName, address, phone, DOB, gender, maritalStatus, dateRegistered)

    SurgSupplies(itemNo, itemName, description, quantity, reorderLevel, costPerUnit)

    PharmSupplies(drugNo, drugName, description, dose, adminMethod, quantity, reorderLevel, costPerUnit)

    Supplier(supplyNo, supplyName, supplyAddress, supplyPhone, fax)

    Doctor(clincNo, fName, lName, docAddress, docPhone)


    rely on StaffMember
    Qualifications(qualificationType, qualificationDate, institute, staffNo)
    WorkExperience(org, orgPosition, orgStart, orgFinish, staffNo)
    WorkInfo(position, salary, salaryType*, hoursWorked, workStatus**, workShift***, staffNo)

    * - salaryType = Weekly or Monthly salary
    ** - workStatus = Permanent or Temporary
    *** - workShift = Early, Late, or Night shift (unsure if needed)

    rely on StaffMember, Patient
    Ward(wardNo, wardName, wardLoc, chargeNurse, phoneExtn, staffNo,
    patientNo)

    Appointment(appNo, aDate, aTime, examRoom, staffNo, patientNo)


    rely on Patient
    NextOfKin(fName, lName, relationship, nokAddress, phone, patientNo)
    Outpatient(patientNo, aDate, aTime)

    rely on Patient, PharmSupplies
    Medication(fName, lName, drugNo, drugName, unitsPerDay, adminMethod, startDate,
    endDate, patientNo)

    rely on Patient, Ward
    Inpatient(bedNo, patientNo, dateOnList, wardNo, daysToStay, inWardDate, expectedOutDate,
    actualOutDate)


    rely on StaffMember, Ward, SurgSupplies, PharmSupplies
    Requisitions(reqNo, staffNo, staffName, wardNo, wardName, itemNo, drugNo)



    These are my dependancies

    Spoiler: show

    Functional Dependency Analysis

    Ward
    WardNo  wardName, wardLoc, phoneExtn

    Staff
    StaffNo  fName, lName, address, phone, DOB, Gender

    Qualifications
    staffNo  qualificationType, qualificationDate, institute

    WorkExperience
    StaffNo  org, OrgPosition, orgStart, orgFinish

    WorkInfo
    staffNo  position, salary, salaryType, hoursWorked, workStatus, WorkShift

    Patients
    PatientNo  fname, lname, address, phone, dob, gender

    Kin
    PatientNo  fname, lname, relationship, nokAddress, phone

    Doctor
    clincNo  fname, lname, docAddress, docPhone

    Appointment
    appNo  aDate, aTime, examRoom

    Outpatients
    patientNo  aDate, aTime

    Inpatients
    BedNo  patientNo

    patientNo  dateonList, wardNo, daysToStay, inWardDate, expectedOutDate, acutalOutDate

    Medication
    drugNo  drugName
    drugName  fname, lName, drugName, unitsPerday, adminMethod, startDate, endDate, patientNo

    Surgery Supplies
    itemNo  itemName
    ItemName  description, quantity, reorderLevel, costPerUnit

    Pharmacy Supplies
    drugNo  drugName
    drugName  description, dose, adminMethod, quantity, reoderLevel, costPerUnit

    Requisitions
    reqNo  staffNo, staffName, wardNo, wardName, itemNo, drugNo

    Suppliers
    supplyNo  supplyName
    supplyName  supplyAdress, supplyPhone, fax



    Did i cover everything? Is there anything I'm missing or that i have that shoulden be there?

  10. #70
    Banned.

    Join Date
    Oct 2006
    Posts
    10,159
    BG Level
    9

    Quote Originally Posted by Penthesilea View Post
    I'm just going to piggy back off this thread, since its in the same vein as the OP.

    I'm a biologist thrust into new responsibilities of being an Oracle DBA as well. I've been requested to run a query to extract some meta data. Problem is one of the fields is a BLOB, which I can "view" the contents in hex binary. Problem is, I'm not sure what type of file they went into the field as (jpg, gif, some other format). Is there an easy way to figure that out or to write them out to disk somewhere?

    From all my googling, it doesn't make sense that they would store the files directly in the DB, rather just store the path. I'm at loss here and any help would be appreciated!

    I also looked through procedures and packages to see if there was already something set up to do just what I'm looking for, and having no luck.
    Don't know much about oracle but in MS SQL the blobs usually have additional columns to indicate the file type.

  11. #71

    Quote Originally Posted by Tajin View Post
    Don't know much about oracle but in MS SQL the blobs usually have additional columns to indicate the file type.
    Well, it should all be the same file type, but I have no idea what that type is. I'm new, taking over for a guy who just up and left, so I've had no training and on top of that, the DBA was worthless.

    There's two fields that should have the same information, the OBJSSTRCT and OBJSMOLFILE, the first being a blob, the second a clob. The clob isn't "null" when I return the data, but when I try to use dbms_lob.read, I also get an error (see the first image in spoiler).
    Spoiler: show





    my quick read query of the CLOB.
    Spoiler: show
    Code:
    declare
    locator_var CLOB;
    amount_var  INTEGER;
    offset_var  INTEGER;
    output_var   VARCHAR2(100);
    
    Begin
    amount_var :=50;
    offset_Var :=1;
      select OBJSMOLFILE into locator_var
      FROM CHEMSTRUCT
      Where OBJDID = 'LDN-0022322';
      DBMS_LOB.READ(locator_var, amount_var, offset_var, output_var);
      DBMS_OUTPUT.PUT_LINE('Start of MOL: ' || output_var);
     End;
     /

  12. #72
    Black Belt
    Join Date
    Aug 2005
    Posts
    5,907
    BG Level
    8
    FFXI Server
    Quetzalcoatl

    Quote Originally Posted by Aylee View Post
    Ok doing a big case study. I have to make the functional dependencies. This is what my Partner Sent me:

    Spoiler: show


    StaffMember(staffNo, fName, lName, address, phone, DOB, gender)

    Patient(patientNo, fName, lName, address, phone, DOB, gender, maritalStatus, dateRegistered)

    SurgSupplies(itemNo, itemName, description, quantity, reorderLevel, costPerUnit)

    PharmSupplies(drugNo, drugName, description, dose, adminMethod, quantity, reorderLevel, costPerUnit)

    Supplier(supplyNo, supplyName, supplyAddress, supplyPhone, fax)

    Doctor(clincNo, fName, lName, docAddress, docPhone)


    rely on StaffMember
    Qualifications(qualificationType, qualificationDate, institute, staffNo)
    WorkExperience(org, orgPosition, orgStart, orgFinish, staffNo)
    WorkInfo(position, salary, salaryType*, hoursWorked, workStatus**, workShift***, staffNo)

    * - salaryType = Weekly or Monthly salary
    ** - workStatus = Permanent or Temporary
    *** - workShift = Early, Late, or Night shift (unsure if needed)

    rely on StaffMember, Patient
    Ward(wardNo, wardName, wardLoc, chargeNurse, phoneExtn, staffNo,
    patientNo)

    Appointment(appNo, aDate, aTime, examRoom, staffNo, patientNo)


    rely on Patient
    NextOfKin(fName, lName, relationship, nokAddress, phone, patientNo)
    Outpatient(patientNo, aDate, aTime)

    rely on Patient, PharmSupplies
    Medication(fName, lName, drugNo, drugName, unitsPerDay, adminMethod, startDate,
    endDate, patientNo)

    rely on Patient, Ward
    Inpatient(bedNo, patientNo, dateOnList, wardNo, daysToStay, inWardDate, expectedOutDate,
    actualOutDate)


    rely on StaffMember, Ward, SurgSupplies, PharmSupplies
    Requisitions(reqNo, staffNo, staffName, wardNo, wardName, itemNo, drugNo)



    These are my dependancies

    Spoiler: show

    Functional Dependency Analysis

    Ward
    WardNo  wardName, wardLoc, phoneExtn

    Staff
    StaffNo  fName, lName, address, phone, DOB, Gender

    Qualifications
    staffNo  qualificationType, qualificationDate, institute

    WorkExperience
    StaffNo  org, OrgPosition, orgStart, orgFinish

    WorkInfo
    staffNo  position, salary, salaryType, hoursWorked, workStatus, WorkShift

    Patients
    PatientNo  fname, lname, address, phone, dob, gender

    Kin
    PatientNo  fname, lname, relationship, nokAddress, phone

    Doctor
    clincNo  fname, lname, docAddress, docPhone

    Appointment
    appNo  aDate, aTime, examRoom

    Outpatients
    patientNo  aDate, aTime

    Inpatients
    BedNo  patientNo

    patientNo  dateonList, wardNo, daysToStay, inWardDate, expectedOutDate, acutalOutDate

    Medication
    drugNo  drugName
    drugName  fname, lName, drugName, unitsPerday, adminMethod, startDate, endDate, patientNo

    Surgery Supplies
    itemNo  itemName
    ItemName  description, quantity, reorderLevel, costPerUnit

    Pharmacy Supplies
    drugNo  drugName
    drugName  description, dose, adminMethod, quantity, reoderLevel, costPerUnit

    Requisitions
    reqNo  staffNo, staffName, wardNo, wardName, itemNo, drugNo

    Suppliers
    supplyNo  supplyName
    supplyName  supplyAdress, supplyPhone, fax



    Did i cover everything? Is there anything I'm missing or that i have that shoulden be there?
    I'm having a hard time following this, is the first one a logical notation? It doesn't have any primary keys etc. so it's hard to tell.

    Have you made a class diagram for it you can include, too?

    Edit: Not sure if you've done a class diagram, but I made one that I believe will help. I did it hastily, so it's not perfect and looks kind of cluttered, but you can take it and work on it. It should answer the questions you need, as it makes the dependencies rather obvious.



    I had to make some edits though as it had some null (a big no-no in most cases as it makes for "ugly" and inefficient databases), but I had to leave one of them in, which is the actualOutDate in the Inpatient class, as I'm not sure what your exact project is. If possible, I would recommend making it a reified class to avoid null, or moving it somewhere else. You could also, if possible, completely remove it, since that information would already exist in "outpatient" through aDate and aTime. My recommendation would be to make it a reification though, as you may need that information (for insurance purposes or whatever), and an inpatient does not necessarily become an outpatient.

    There are some other unclears as I haven't read the project text. For example,;
    1) Can a staff member be employed at more than one ward within the same clinic, or does he/she specifically work in one clinic?

    2) Does a doctor also have a staffNo? (According to your partner's notation, a doctor does not have a staffNo, but logically he should have, which is what I show in the diagram. If, however, a doctor does not have a staffNo, then the staffNo attribute should be moved out of the StaffMember class and instead be moved in to the classes that needs it, like Nurse).

    3) Can a staff member work at more than one clinic? I assume not, since the doctor is tied to a specific clinic ID in your logical notation. But I'm sure you can figure it out.

    4) Can SurgSupplies and PharmSupplies be purchased from more than one supplier? If not; 1..1 -> 0..* multiplier. Otherwise, 1..* -> 0..* multiplier.

    From the class diagram you can then turn it in to a logical notation, which will show the dependencies, unless your teacher is asking for some other form of notation to show the dependencies, as a logical notation makes dependencies very clear. Take the relationship between Person, StaffMember, Clinic and Doctor, for example

    Person.(fName, lName, homeAddress, phoneNumber)

    StaffMember.(fName, lName, homeAddress, phoneNumber, staffNo, gender)
    StaffMember.(fName, lName, homeAddress, phoneNumber) <- Person.(fName, lName, homeAddress, phoneNumber)
    AK1 StaffMember.(fName, lName, homeAddress, phoneNumber)

    Clinic.(clinicNo, clinicAddress, clinicPhone, clinicFax, clinicName)

    Doctor.(fName, lName, homeAddress, phoneNumber, staffNo, gender, clinicNo)
    Doctor.(staffNo) <- staffMember.(staffNo)
    Doctor.(clinicNo) <- Clinic.(clinicNo)
    AK1 Doctor.(fName, lName, homeAddress, phoneNumber)

    I'm not familiar with the way you wrote it out, so I can't tell if it's accurate or not. Whats worse is, there's squares on my computer, so I can't tell if there's supposed to be arrows or some other sign Or is it written out as a table? can't tell xD Although it might be partly because I just came home from vacation and my brain is a mush from the travelling.

    Edit: I looked over it and I think I figured it out. Sorry, my head is a mush, so it took me a while, I assume the squares are supposed to show which one is the primary key, and the other ones show the dependencies. It looks OK, although it still doesn't solve some of the issues you'll run in to later with null values. I would recommend a Clinic class that Doctor is a dependency to, and Ward has a dependency to Clinic. I would also recommend a reification of actualOutDate with a dependency to PatientNo to get rid of that problem, since you really do not want 0..1 or 0..* multiplicities on any attributes in tables. NULL values can cause a lot of problems when it comes to pulling out data, comparing data, sorting data etc. For example, joining tables together can produce unexpected results, aggregation WILL give you unexpected results without an error code if any of them have null values, etc. It makes programming very unsafe as you're never sure whether or not you can be confident that the data exists or not. NULL values can be used, and can be useful under the right circumstances, but I'm not sure if this is one of them - especially since it would be easier from a programming-standpoint with a reification.

+ Reply to Thread
Page 4 of 4 FirstFirst ... 2 3 4

Similar Threads

  1. SQL Database - Help studying for Test
    By Aylee in forum Tech
    Replies: 3
    Last Post: 2013-11-06, 14:56
  2. SQL Help
    By Buffy in forum Tech
    Replies: 7
    Last Post: 2013-10-18, 18:43
  3. SQL help
    By Saga in forum Tech
    Replies: 3
    Last Post: 2012-11-29, 18:24
  4. SQL help
    By saracrow in forum Tech
    Replies: 4
    Last Post: 2011-07-01, 00:22