0% found this document useful (0 votes)
58 views6 pages

Practical 1 DBMS Uvpce

This document contains the output of various SQL queries performed by a student named Prabhat Sharma on tables like Installment, Account, and Loan. The queries include selecting data from columns, modifying table structures by adding or altering columns, updating records by changing values, creating new tables from existing ones, deleting tables and records, and ordering results. The student is studying basics of DBMS and SQL commands like DDL and DML.

Uploaded by

PRABHAT SHARMA
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)
58 views6 pages

Practical 1 DBMS Uvpce

This document contains the output of various SQL queries performed by a student named Prabhat Sharma on tables like Installment, Account, and Loan. The queries include selecting data from columns, modifying table structures by adding or altering columns, updating records by changing values, creating new tables from existing ones, deleting tables and records, and ordering results. The student is studying basics of DBMS and SQL commands like DDL and DML.

Uploaded by

PRABHAT SHARMA
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/ 6

22012011040 PRABHAT SHARMA CEIT-A(3A-1)

PRACTICAL 1
AIM : Study of Basics of DBMS, SQL. Perform SQL queries for DDL &
DML Commands.
1. Display all rows and all columns of table Installment.
Ans : select * from INSTALLMENT;

2. Display all rows and selected columns of table Installment.

Ans : select loan_no,amount from INSTALLMENT;

3. Display selected rows and selected columns of table Account.


Ans : select name from account where acc_no = 'A001';

4. Display selected rows and all columns of table loan.

Ans : select * from loan where loan-no = 'L001';

22012011040 PRABHAT SHARMA CEIT-A(3A-1)


5. Show the structure of the table loan, account and installment.

Ans : desc account;


desc loan;
desc INSTALLMENT;

6. Change
hange the name ‘Patel Jigar’ to ‘Patel Hiren’ in Account Table.
Ans : update account set name = ‘Patel Hiren’ where name = ‘Patel Jigar’;

7. Change the name and cityy where account number is A005.(new


(new name = ‘Kothari
Nehal’ and new city = ‘Kherva’).
Ans : update account set name = ‘Kothari Nehal’,city= ‘Kherva’ where
acc_no =’A005’;

22012011040 PRABHAT SHARMA CEIT-A(3A-1)


1)
8. Display only those records where loan taken status is ‘YES’.
Ans : Select * from account where loan_taken = ‘YES’.

9. Add the new column (address varchar2 (20)) into table ACCOUNT.
Ans : alert table account ADD address varchar2(20);

10. Modify the structure of table LOAN by adding one column credit_no varchar2
(4) (Loan table).
Ans : alert table loan ADD credit_no varchar2(4);

11. Create another table ACCOUNT_TEMP having columns (acc_no, name, balance)
from table ACCOUNT.
Ans : create table account_temp as select acc_no,name,balance from
account;

12. Create another table LOAN_TEMP (loan_no, Acc_no, loan_amt, loan_date) from
the table LOAN.
Ans : create table loan_temp as select loan_no,acc_no,loan_amt,loan_date
from loan;

22012011040 PRABHAT SHARMA CEIT-A(3A-1)


13. Create another table TRANS_TEMP by change the column name acc_no to
account_no.
Ans : create table
trans_temp(account_no,name,city,balance,laon_taken,address) as select *
from account;

14. Increase the size 5 to 7 of column acc_no (Loan table).


Ans : alert table loan modify acc_no varchar2(7);

15. Delete the records whose account no is A004.


Ans : delete from account where account_no = ‘A004’;

16. For each loan holders Increase the interest rate by 2% (Loan table).
Ans : update loan set interest_rate = (interest_rate+2);

17. Display only those records where loan holder taken a loan in month of
January(Loan table).
Ans : select * from loan where to_char(loan_date,’Month’) = ‘January’;

22012011040 PRABHAT SHARMA CEIT-A(3A-1)


18. Change the Inst_Date ‘2-Feb-21’ to ’3-Mar-22’.
Ans : update INSTALLMENT set inst_date=’2-Feb-21’ where inst_date=’3-
Mar-22’;

19. Display the Loan amount*2 of table LOAN.


Ans : select loan_amt*2 from loan;

20. Change the loan_amt 100000 to 150000 where loan number is L001 (Loan
table).

Ans : update loan set loan_amt = 15000 where loan_no=’L001’;

21. Display loan_no, amount of Installment table by date wise.


Ans : select loan_no,amount from INSTALLMENT order by Inst_date ASC;

22012011040 PRABHAT SHARMA CEIT-A(3A-1)


22. Select all the records of account table in descending order (account number
wise).
Ans : select * from account order by acc_no DESC;

23. Delete a table LOAN_TEMP.

Ans : drop table loan_temp;

22012011040 PRABHAT SHARMA CEIT-A(3A-1)

You might also like