Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

1.

Create tablespace:

create tablespace MCALAB datafile 'mc.dat' size 30M;

Checking:

select default_tablespace from dba_users;

output:-

2. Create User:

create user ballu identified by b123 default tablespace MCALAB;

Checking:

select username, default_tablespace from dba_users ;

output:-
3.Create table:

create table command

create table student(std_id varchar(20) primary key,std_name


varchar(50),subjects varchar(50));

Checking:

select * from student;

desc student;

output:-

4. Moving of Data:

create table cust as select * from customer;

Checking:

Select * from cust;


5. Locking& Unlocking:

alter user murali account lock;

alter user mca account lock;

alter user mca account unlock;

Checking:

Try to login the user


6. Bank Database & Employee Database Queries:

1. Bank Database

All the Table structures

Desc Customer;

Desc Branch;……

In 2017
Bank Database
Branch (bname, bcity, assets)
Customer (cname, cstreet, ccity)
Loan (lno, bname, amt)
Borrower (cname, lno)
Account (ano, bname, bal)
Depositor (cname, ano)

1. Find all loan no.s made at JP Nagar Branch with loan amount
greater than 10000
Select lno, amt from loan1 where b_name = 'jp nagar' and amt>
10000;
2. Find the no. of Depositors in the Bank.
Select count (distinct c_name) from depositor;

3. Find all loan details in descending order of loan amount and


ascending order of loan number.
Select * from loan1 order by amt desc, lno asc;

4. List all the loan details along with interest of 10%.


Select b_name, lno, amt, amt*10/100 as Interest from loan1;

5. Find Average Account Balance at each branch.


Select b_name, avg(bal) from account group by b_name;
6. Find the name, account number and Balance amount of all
customers of KS Layout in ascending order of customer name.

Select c_name, depositor. Ano, Bal from depositor, account where


depositor. Ano = Account. Ano and b_name = 'ks layout' order by
c_name;

7. Delete the column Cstreet in Customer table.


Alter customer drop column c_street;

You might also like