Вы находитесь на странице: 1из 3


1) Create an account table with the following attributes- account number., balance.

SQL> create table account(acctno number(10),balance number(10),primary key(acctno)); Table created.

2) Create a depositor table with the following attributes- customer name, customer id,

account nnumber. SQL> create table depositor(custname varchar2(10),custid number(10),acctno number(10)); Table created.
3) Create the loan table with the following attributes- loan number, branch name, loan

amount. SQL> create table loan(loanno number(10),branchname varchar2(10),loanamt number(10)); Table created.
4) Create the borrower table with the following attributes- employee name, ssn number,

address, department number. SQL> create table borrower(empname varchar2(10),ssnno number(10),address varchar2(10),deptno number(10)); Table created.
5) Create a department table with the following attributes- department number, department

name, employee number, employee name. SQL> create table department(deptno number(10),deptname varchar2(10),empno number(10),empname varchar2(20)); Table created.
6) Create a table student with the following attributes- serial number, register number,

student name, gender, marks, grade. SQL> create table student(serialno number(10),regno number(10),studentname varchar2(10),gender number(10),marks number(10),grade varchar2(10)); Table created. 7) Display the structures of all tables.

SQL> desc account; Name Null? Type ----------------------------------------- ----------------- ---------------------------ACCTNO NOT NULL NUMBER(10) BALANCE NUMBER(10) SQL> desc depositor; Name Null? Type ----------------------------------------- -------- ---------------------------CUSTNAME VARCHAR2(10) CUSTID NUMBER(10) ACCTNO NUMBER(10) SQL> desc loan; Name Null? Type ----------------------------------------- -------- ---------------------------LOANNO NUMBER(10) BRANCHNAME VARCHAR2(10) LOANAMT NUMBER(10) SQL> desc borrower; Name Null? Type ----------------------------------------- -------- ---------------------------EMPNAME VARCHAR2(10) SSNNO NUMBER(10) ADDRESS VARCHAR2(10) DEPTNO NUMBER(10) SQL> desc department; Name Null? Type ----------------------------------------- -------- ---------------------------DEPTNO NUMBER(10) DEPTNAME VARCHAR2(10) EMPNO NUMBER(10) EMPNAME VARCHAR2(10) SQL> desc student; Name Null? Type ----------------------------------------- -------- ---------------------------SERIALNO NUMBER(10) REGNO NUMBER(10) STUDENTNAME VARCHAR2(10) GENDER VARCHAR2(10) MARKS NUMBER(10) GRADE VARCHAR2(10) 8) Add amount attribute to the depositor table.

SQL> alter table depositor add(amount number(10)); Table altered. 9) Remove customer name attribute from the depositor table. SQL> alter table depositor drop(custname); Table altered.

Increase the width of the column account no. in the account table to 30.

SQL> alter table account modify(acctno number(30)); Table altered. 11) Disable the primary key of account table. SQL> alter table account disable primary key; Table altered. 12) Enable the primary key of account table. SQL> alter table account enable primary key; Table altered.

Select attribute where student name is ABCD.

SQL> select * from student where studentname='abcd'; SERIALNO REGNO STUDENTNAME GENDER MARKS GRADE ----------------- ----------------- ------------------------ --------------- ----------- ------------3 1080920019 abcd male 90 A+

Result:- Thus the simple queries using DDL commands has been successfully implemented and the output was verified.