0% found this document useful (0 votes)
187 views

Assignment 4

The document describes an assignment to create tables for a banking database with various constraints. The tables are: Customer, Account, Depositor, Loan, Branch, and Installment. Records are provided to insert into the tables, including customer, account, depositor, loan, branch, and installment data. The objective is to create the tables using the specified column names and constraints.

Uploaded by

Ashish Kabi
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)
187 views

Assignment 4

The document describes an assignment to create tables for a banking database with various constraints. The tables are: Customer, Account, Depositor, Loan, Branch, and Installment. Records are provided to insert into the tables, including customer, account, depositor, loan, branch, and installment data. The objective is to create the tables using the specified column names and constraints.

Uploaded by

Ashish Kabi
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/ 5

Laboratory Assignments

Subject: Introduction to Databases


Subject code: CSE 3151

Assignment 4: Table creation using Database Constraints

Objective of this Assignment:


 To create table with proper integrity constraints.

1. Create the Tables for the following descriptions using the constraints as specified.

TABLE NAME-- CUSTOMER

COLUMN NAME CONSTRAINT DESCRIPTION


CUST_NO -PRIMARY KEY
-MUST BE 5 CHARACTER LONG & START WITH
LETTER 'C'
NAME NOT NULL
PHONE_NO
CITY NOT NULL

TABLE NAME-- ACCOUNT

COLUMN NAME CONSTRAINT DESCRIPTION


ACCOUNT_NO -PRIMARY KEY
-MUST BE 5 CHARACTER LONG & START WITH
LETTER 'A'
TYPE -TYPES- 'SB', 'FD', 'CA'
BALANCE -MUST BE < 10000000
BRANCH_CODE -FOREIGN KEY, REFERS TABLE BRANCH
TABLE NAME-- DEPOSITOR

COLUMN NAME CONSTRAINT DESCRIPTION


CUST_NO -FOREIGN KEY, REFERS TABLE CUSTOMER
-PRIMARY KEY
ACCOUNT_NO -FOREIGN KEY, REFERS TABLE ACCOUNT
-PRIMARY KEY

TABLE NAME-- LOAN

COLUMN NAME CONSTRAINT DESCRIPTION


LOAN-NO -PRIMARY KEY
-MUST BE 5 CHARACTER LONG & START WITH
LETTER 'L'
CUST_NO -FOREIGN KEY, REFERS TABLE CUSTOMER
AMOUNT -MUST BE > 1000
BRANCH_CODE -FOREIGN KEY, REFERS TABLE BRANCH

TABLE NAME-- BRANCH

COLUMN NAME CONSTRAINT DESCRIPTION


BRANCH_CODE -PRIMARY KEY
BRANCH_NAME -NOT NULL
BRANCH_CITY -ANY METRO CITY OF INDIA – DELHI, MUMBAI,
KOLKATA, CHENNAI.

TABLE NAME- INSTALLMENT

COLUMN NAME CONSTRAINT DESCRIPTION


INST_NO -PRIMARY KEY
-MUST BE<=10
LOAN_NO -PRIMARY KEY
-FOREIGN KEY, REFERS TABLE LOAN
INST_AMOUNT -NOT NULL

2. Insert the records to the tables as specified:


CUSTOMER
CUST_NO NAME PHONE_NO CITY
C0001 RAJ ANAND SINGH 9861258466 DELHI
C0002 ANKITA SINGH 9879958651 BANGALORE
C0003 SOUMYA JHA 9885623344 MUMBAI
C0004 ABHIJIT MISHRA 9455845425 MUMBAI
C0005 YASH SARAF 9665854585 KOLKATA
C0006 SWAROOP RAY 9437855466 CHENNAI
C0007 SURYA NARAYAN 9937955212 GURGAON
PRADHAN
C0008 PRANAV PRAVEEN 9336652441 PUNE
C0009 STUTI MISRA 7870266534 DELHI
C0010 ASLESHA TIWARI MUMBAI
ACCOUNT

ACCOUNT_NO TYPE BALANCE BRANCH_CODE


A0001 SB 200000 B003
A0002 SB 15000 B002
A0003 CA 850000 B004
A0004 CA 35000 B004
A0005 FD 28500 B005
A0006 FD 550000 B005
A0007 SB 48000 B001
A0008 SB 7200 B002
A0009 SB 18750 B003
A0010 FD 99000 B004

DEPOSITOR

CUST_NO ACCOUNT_NO
C0003 A0001
C0004 A0001
C0004 A0002
C0006 A0003
C0006 A0004
C0001 A0005
C0002 A0005
C0010 A0006
C0009 A0007
C0008 A0008
C0007 A0009
C0006 A0010

LOAN

LOAN-NO CUST_NO AMOUNT BRANCH_CODE


L0001 C0005 3000000 B006
L0002 C0001 50000 B005
L0003 C0002 8000000 B004
L0004 C0010 100000 B004
L0005 C0009 9500000 B005
L0006 C0008 25000 B006

BRANCH

BRANCH_CODE BRANCH_NAME BRANCH_CITY


B001 JANAKPURI BRANCH DELHI
B002 CHANDNICHOWK BRANCH DELHI
B003 JUHU BRANCH MUMBAI
B004 ANDHERI BRANCH MUMBAI
B005 SALTLAKE BRANCH KOLKATA
B006 SRIRAMPURAM BRANCH CHENNAI

INSTALLMENT

INST_NO LOAN_NO INST_AMOUNT


1 L0005 500000
1 L0002 10000
1 L0003 50000
1 L0004 20000
2 L0005 500000
1 L0006 3000
2 L0002 10000
3 L0002 10000
2 L0003 50000
2 L0004 20000

You might also like