Oracle join table and calculation problem - TechRepublic
Question
April 23, 2007 at 12:48 PM
alex789

Oracle join table and calculation problem

by alex789 . Updated 19 years, 2 months ago

Hi all and thanks in advance,

I need to output the patient’s name, patient’s address, item_code, description, and total cost for a particular month in the folloing tables.

Here are the tables

CREATE TABLE patient(
pati_Ref_no NUMBER(6) NOT NULL,
name VARCHAR2(8),
dob DATE,
address VARCHAR2(15),
PRIMARY KEY(pati_Ref_no));

CREATE TABLE items(
item_code NUMBER(4) NOT NULL,
description VARCHAR2(20),
cost NUMBER(6,2),
PRIMARY KEY(item_code));

CREATE TABLE charge(
pati_Ref_no NUMBER(6) NOT NULL,
itemcode NUMBER(4) NOT NULL,
chargedate DATE,
PRIMARY KEY(pati_ref_no, itemcode, chargedate),
FOREIGN KEY(pati_ref_no)REFERENCES patient,
FOREIGN KEY(item_code)REFERENCES items);

Thank you for your reply.

This discussion is locked

All Comments