You are on page 1of 4

1.

About the system:

"Customer Water Bills." In general, it refers to a system or process that involves generating
and managing water bills for customers.

Water bills are typically issued by water utility companies or municipalities to customers
who consume water services. These bills reflect the amount of water consumed by each
customer over a specific period, such as a month, and include details such as the billing
period, meter readings, rates, and the amount due.

The purpose of managing customer water bills is to accurately calculate the amount owed
by customers for the water services they have used. It involves tracking customer
information, meter readings, calculating charges based on consumption, generating bills,
and managing the collection of payments.

A database system can be used to store and manage the relevant data associated with
customer water bills. This may include customer details such as names, addresses, and
contact information, as well as billing information such as meter readings, billing periods,
amounts due, and payment statuses.

By maintaining an organized and efficient system for customer water bills, utility
companies can ensure accurate billing, streamline payment processes, and provide a
transparent and reliable service to their customers.
2. Logical Model:

3. Relational Model:
Generate DDL:

CREATE TABLE customer (

id NUMBER NOT NULL,

name VARCHAR2(25) NOT NULL,

address VARCHAR2(40),

phone VARCHAR2(12),

email VARCHAR2(200) NOT NULL

);

ALTER TABLE customer ADD CONSTRAINT customer_pk PRIMARY KEY ( id );

CREATE TABLE payment (

id NUMBER NOT NULL,

"date" DATE NOT NULL,

amount NUMBER NOT NULL,

bill_id NUMBER NOT NULL

);

ALTER TABLE payment ADD CONSTRAINT payment_pk PRIMARY KEY ( id );

CREATE TABLE water_bill (

id NUMBER NOT NULL,

amount NUMBER NOT NULL,

"date" DATE NOT NULL,

due_date DATE NOT NULL,

status SMALLINT NOT NULL,

customer_id NUMBER NOT NULL

);
ALTER TABLE water_bill ADD CONSTRAINT water_bill_pk PRIMARY KEY ( id );

ALTER TABLE payment

ADD CONSTRAINT payment_water_bill_fk FOREIGN KEY ( bill_id )

REFERENCES water_bill ( id );

ALTER TABLE water_bill

ADD CONSTRAINT water_bill_customer_fk FOREIGN KEY ( customer_id )

REFERENCES customer ( id );

You might also like