SQL statements to create database tables and to insert some sample data (at leas
ID: 3923977 • Letter: S
Question
SQL statements to create database tables and to insert some sample data (at least 5 rows per table).
For these 3 tables:
Customer: customer name , customer address , customer phone number , customer email address , customer account number , customer account balance
Customer Monthly Bill: customer account number , customer date (year and month) , customer electricity usage (kw) , customer gas usage (therm) , customer total charge
Rate Table: unit charge for electricity (year and month) , unit charge for gas (year and month) , flat fee (year and month)
Explanation / Answer
creating customer table
create table customer
(
customer_name varchar2(10),
customer_address varchar2(20),
customer_phone_number number(10),
customer_email_address varchar2(10),
customer_account_number number(10),
customer_account_balance number(10)
);
table created
inserting five rows
insert into customer values('pavan','newcolony',900000999,'pavana@gamail.com',10000344,120000);
insert into customer values('yerra','california',90000088,'yerra@gamail.com',10000355,140000);
insert into customer values('pavani','kasibugga',90000077,'pavani@gamail.com',10000377,120456);
insert into customer values('sai','vizag',90000044,'sai@gamail.com',10000399,1200788);
insert into customer values('praveen','kavli',90000033,'praveen@gamail.com',10000222,110000);
2)creating customer monthy bill table
create table customer_monthly_bill
(
customer_account_number number(10),
customer_date date,
customer_electricity_usage(kw) number(5),
customer_gas_usage number(therm)(5),
customer_total_charge(5)
);
inserting five rows
insert into customer_monthly_bill values(10000123,'10-oct-16',150,20,45623);
insert into customer_monthly_bill values(10000111,'06-may-16',130,10,34563);
insert into customer_monthly_bill values(10000124,'10-jun-16',160,20,55673);
insert into customer_monthly_bill values(10003456,'16-jul-16',110,10,25323);
insert into customer_monthly_bill values(10000343,'09-sep-16',170,20,65623);
3)
create table rate_table
(
unit_charge_ele_per_month number(5),
unit_charge_ele_per_year number(6),
unit_charge_gas_per_month number(5),
unit_charge_gas_per_year number(5),
falt_fee_per_month number(5),
falt_fee_per_year number(5),
)
inserting five rows
insert into rate_table values(120,2220,20,440,200,2300);
insert into rate_table values(110,2120,21,410,210,2100);
insert into rate_table values(150,2520,25,450,250,2500);
insert into rate_table values(160,2720,27,470,270,2770);
insert into rate_table values(170,4720,30,550,400,3300);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.