0% found this document useful (0 votes)
56 views4 pages

Dbms

The document defines the structure of 4 database tables - Account, Loan, Installment, and Transaction. It specifies the columns and data types for each table. It then provides INSERT statements to populate the tables with sample data. Finally, it lists some basic SELECT queries to retrieve data from the tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views4 pages

Dbms

The document defines the structure of 4 database tables - Account, Loan, Installment, and Transaction. It specifies the columns and data types for each table. It then provides INSERT statements to populate the tables with sample data. Finally, it lists some basic SELECT queries to retrieve data from the tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

CREATE A TABLE ACCOUNT

Column name Data Type Size


acc_no varchar2 5
Name varchar2 30
City varchar2 20
Balance Number 10,2
loan_taken varchar2 5

1. create table account(acc_no varchar2(5),name varchar2(30),city


varchar2(30), balance number(10,2),loan_taken varchar2(5));

INSERT THE FOLLOWING RECORDS.

acc_no Name City Balance loan_taken


A001 Patel Jigar Mehsana 50000 YES
A002 Patel Ramesh Mehsana 50000 YES
A003 Dave Hardik Ahmedabad 75000 NO
A004 Soni Hetal Ahmedabad 100000 NO
A005 Sony Atul Vadodara 100000 YES

1. insert into account values(‘A001’,’Patel Jigar’,’Mehsana’,50000,’Yes’);


2. insert into account values(‘A002’,’Patel Ramesh’,’Mehsana’,50000,’Yes’);
3. insert into account values(‘A003’,’Dave Hardik’,’Ahmedabad’,75000,’No’);
4. insert into account values(‘A004’,’Soni Hetal’,’Ahmedabad’,100000,’No’);
5. insert into account values(‘A005’,’Sony Atul’,’Vadodara’,100000,’Yes’);

QUERY
1. Display selected rows and selected columns of table Account.
 Select acc_no,name from account where acc_no=’A002’;
2. Show structure of account.
 Desc account;

1
2. CREATE A TABLE LOAN

Column Name Data Type Size


loan_no varchar2 5
acc_no varchar2 5
loan_amt number 10,2
interest_rate number 5,2
loan_date date -
remaining_loan number 10,2

1. create table loan(loan_no varchar2(5),acc_no varchar2(5),loan_amt


number(10,2), interest_rate number(5,2),loan_date date, remaining_loan
number(10,2));

INSERT THE FOLLOWING RECORDS.

Loan_no Acc_no Loan_amt Interest_rate Loan_date Remaining_loan


L001 A001 100000 7 1-jan-04 75000
L002 A002 300000 9 18-may-04 150000
L003 A005 500000 11 15-june-04 300000

1. insert into loan values(‘l001’,’a001’,100000,7,’1-jan-04’,75000);


2. insert into loan values(‘l002’,’a002’,300000,9,’18-may-04’,150000);
3. insert into loan values(‘l003’,’a003’,500000,11,’15-june-04’,300000);

QUERY
1. Display selected rows and all columns of table loan.
● select * from loan where loan_no=’l001’;
2. Show the structure of the table loan.
● desc loan;

2
3.CREATE A TABLE INSTALLMENT

Column Name Data Type Size


loan_no varchar2 5
inst_no varchar2 5
inst_Date date
Amount number 10,2

1. Create table installment (loan_no varchar2 (5),inst_no varchar2(5),inst_date


date,amount number(10,2));

INSERT FOLLOWING RECORDS

Loan_no Inst_no Date Amount


L001 I001 2-Feb-04 15000
L002 I002 18-June-04 20000
L003 I003 15-July-04 20000

1. Insert into installment values(‘L001’,’I001’,’2-feb-04’,15000);


2. Insert into installment values(‘L002’,’I002’,’18-june-04’,20000);
3. Insert into installment values(‘L003’,’I003’,’15-july-04’,20000);

QUERY
Display all rows and selected columns of table Installment
 Select loan_no,date,amount from installment;

3
4.CREATE A TABLE TRANSACTION.

Column Name Data Type Size


acc_no Varchar2 5
tr_Date Date
Amt Number 10,2
type_of_tr Char 1
mode_of_pay Varchar2 10

1. Create table transaction(acc_no varchar2(5),tr_date date,amt number(10,2),


type_of_tr char(1), mode_of_pay varchar2(10));

INSERT A FOLLOWING RECORDS.

Acc_no Date Amt Type_of_tr Mode_of_pay


A001 3-may-04 10000 D Cash
A002 5-july-04 5000 W Cheque
A003 12-Aug-04 25000 D Cheque
A004 15-may-04 30000 D Cheque
A005 22-oct-04 15000 W Cash

1. Insert into transaction values (‘A001’,’3-may-04’, 10000,’d’,’cash’);


2. Insert into transaction values (‘A002’,’5-july-04’, 5000,’w’,’cheque’);
3. Insert into transaction values (‘A003’,’12-auq-04’, 25000,’d’,’cheque’);
4. Insert into transaction values (‘A004’,’15-may-04’, 30000,’d’,’cheque’);
5. Insert into transaction values (‘A005’,’22-oct-04’, 15000,’w’,’cash’);

QUERY
1. Display all rows and all columns of table Transaction.
 Select * from transaction;
2. Show the structure of transaction.
 Desc transaction;

You might also like