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

rdbms

The document is a practical record notebook for MCA first-year students at Bharathiar University, focusing on RDBMS applications. It includes various database programs related to banking systems, student mark processing, college admissions, personal information management, hotel management, stock maintenance, and online reservation systems. Each section provides SQL commands for creating tables, inserting data, updating records, and managing database operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

rdbms

The document is a practical record notebook for MCA first-year students at Bharathiar University, focusing on RDBMS applications. It includes various database programs related to banking systems, student mark processing, college admissions, personal information management, hotel management, stock maintenance, and online reservation systems. Each section provides SQL commands for creating tables, inserting data, updating records, and managing database operations.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

lOMoARcPSD|44203781

Rdbms

Computer Applications MCA (Bharathiar University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

School of Distance Education

PRACTICALRECORD NOTE BOOK

1
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

MCA

FIRST YEAR

CIIT CALICUT (KL0804)

2
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

RDBMS

3
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

INDEX

Sl. Date of Name of Contents Page Sign


No 06/01/2021
1 Banking System various Schemes 5
07/01/2021
2 Student Mark processing System 8

14/01/2021
3 College admission system 11

21/01/2021
4 Personal information 15
28/01/2021
5 Hotel Management 18
04/02/2021
6 Stock Maintenance 20
11/02/2021
7 Online Reservation System 22

4
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

1 Banking system various schemes.

Program:

Create table bankaccounts ( customerid


varchar(5),customer_name varchar(10), account_no
varchar(13),balance(8) ) ;

1. insert into table bankaccounts values


(‘A001’,’ramu’,98644354,’10000’);
insert into table bankaccounts values
(‘A002’,jithin,674747623,’20000’);
insert into table bankaccounts values
(‘A003’,khan,34564576,’12000’);
insert into table bankaccounts values
(‘A004’,joe,3546776,’15000’);

2. Select * from table bankaccounts ;

3. Select customer_name ,balance(8) from bankaccounts ;

4. Update table bankaccounts set balance = balance +2000 where


( customerid = ‘A003’ & account_no = ‘34564576’ );

5. delete from table bankaccounts where customerid = ‘A004’;

6. Alter table add phone_no varchar(10);

7.update table bankaccounts set balance = balance -

5
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

withdraw_amount where (cutomerid = ‘A002’ & account_no =


‘674747623’;

8. Alter table bankaccounts drop column phone_no;

9. Drop table bankaccounts ;

Output:

2.

customerid customer_na account_no balance


me

A001 ramu 98644354 10000

A002 jithin 674747623 20000

A003 khan 34564576 12000

6
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

A004 joe 3546776 15000

3.

customer_name balance

ramu 10000

jithin 20000

khan 12000

joe 15000

4. One row updated

5. One row deleted

6. Table altered

7. One row updated

8. Table altered

9. Table dropped

7
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

2 Student mark processing system

Program:

Create table markgrades ( reg_no vrachar(8) primarykey,


subject_intenal varchar(10), subject_external (10),
average_marks varchar(5 ),)

Insert into markgrades ( ‘1’ , ‘ram’ , ‘40’ , ‘60’ , ‘70’);


Insert into markgrades ( ‘2’ , ‘khan’ , ‘80’ , ‘90’ , ‘90’);
Insert into markgrades ( ‘3’ , joe, ‘50’ , ‘20’ , ‘50’);

Alter table markgrades add grade char(2);

If average_marks <=90 ;

Update table markgrades set grade = A where reg_no = reg_no ;

Else If average_marks >=70 and <=89 ;

Update table markgrades set grade = B where reg_no = reg_no ;

Else If average_marks >=60 and <=79 ;

Update table markgrades set grade = C where reg_no = reg_no ;

8
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

Else If average_marks >=50 and <=69 ;

Update table markgrades set grade = D where reg_no = reg_no ;

Else If average_marks >50 ;

Update table markgrades set grade =failed where reg_no =


reg_no ;

End if;
end;

Output

reg_no subject_int subject_ext subject_ext average_m


enal ernal ernal arks

1 ram 40 60 70

2 khan 80 90 90

3 joe 50 20 50

9
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

reg_no subject_in subject_e subject_e averag grade


tenal xternal xternal e_mar
ks

1 ram 40 60 70

2 khan 80 90 90

3 joe 50 20 50

reg_no subject_in subject_e subject_e averag grade


tenal xternal xternal e_mar
ks

1 ram 40 60 70 B

2 khan 80 90 90 A

3 joe 50 20 50 D

10
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

3 College admission system

Program:

Insert into ug_students( ‘1’ , ‘ram’ , ba, 9823454356,);


Insert into ug_students( ‘2’ , ‘khan’ , bca, 9823454356,);
Insert into ug_students( ‘3’ , joe’ , bba, 9823454356);

Insert into pg_students( ‘1’ , ‘ram’ , mca, 9823454356,);


Insert into pg_students( ‘2’ , ‘khan’ , mba, 9823454356,);
Insert into pg_students( ‘3’ , joe, msc, 9823454356);

Create table ug_students(reg_no varchar(2) primarykey,


student_name varchar(10), course varchar(10),phone_no(10));

Create table pg_students(reg_no varchar(2) primarykey,


student_name varchar(10), course varchar(10),phone_no(10));

Char pg= ‘pg’;


Char pg= ‘ug’;

Alt tabe ug_students & pg_students add dob;

If selected = ug;

Insert into ug_students( ‘reg_no’ , ‘student_name’ , course ,


phone_no, dob);

11
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

Else if selected = pg;

Insert into pg_students( ‘reg_no’ , ‘student_name’ , course ,


phone_no, dob);

Insert into pg_students( ‘5’ , roy, msc, 9823454356); where


selected = pg;

Output

Table ug_students

reg_no student_n course phone_no


ame

1 ram ba 98765432

2 khan bca 99987654

12
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

3 joe bba 76543210

table pg_students

reg_no student_n course phone_no


ame

1 ram mca 98765432

2 khan mba 99987654

3 joe msc 76543210

Table ug_students

reg_no student_n course phone_no dob


ame

1 ram ba 98765432

2 khan bca 99987654

3 joe bba 76543210

13
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

Table pg_students

reg_no student_n course phone_no dob


ame

1 ram mca 98765432

2 khan mba 99987654

3 joe msc 76543210

Inserted na row

reg_no student_n course phone_no dob


ame

1 ram mca 98765432

2 khan mba 99987654

3 joe msc 76543210

5 roy msc 89234768

14
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

4 Personal information.

Program

Create table personal_info( person_id varchar(10) , p_name


varchar(10), phone_no varchar(10), address varchar (20) );

Insert table personal_info ( 1 , ‘jhone’,’98765432’, ‘12 house lotus


appatment london’,);
Insert table personal_info ( 3 , ram,8687638475, ‘1 house lion
street london’,);
Insert table personal_info ( 4 , khan,’945685432’, ‘2 house sega
appatment london’,);
Insert table personal_info (5 , roy,74566567, ‘10 house beta street
london’,);

1. Alter table personal_info add row pin varchar(8);

2. Select * from table personal_info ;

3. Update phone_no = 987654321 from table personal_info


where id=3;

4. Alter table personal_info drop column pin

If delete = true;
Delete row from table personal_info where id=id;

15
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

5. Delete row from table personal_info where id=2;

6. Drop table personal_info

Output:

1. Table altered

2.

16
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

person_id p_name phone_no address

1 jhone 987654120 12 house lotus


appatment
london

2 ram 876543205 1 house lion


street london

3 khan 987654321 2 house sega


appatment
london

5 roy 987654324 10 house beta


street london

3. Table updated

4. Table altered

5. Table row delete

6. Table dropped

17
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

5 Hotel Management

Program :

Create table hotel (room_no (2) ,customer_name(10),phone_no


varchar(10));

Insert table hotel(room_no = room_no , customer_name =


customer_name, phone_no = phone_no);

Insert table hotel(101 , roy, 98765432);


Insert table hotel(102 , ram, 98765032);
Insert table hotel(103 , joe, 98765432);

1. Select * from table hotel

2. Alter table hotel add coloumn room_type;

3. Update from hotel customer_name = ‘jhone’ where room_id =


103;

If vacate = true;

4. Delete from table hotel row where id = 102;

5. Drop table hotel

18
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

Output :

1.

room_no customer_name phone_no

101 roy 987654321

102 ram 765432190

103 joe 765432109

2. Table hotel altered

3. Table row updated

4. Table row delete

5. Table droped

19
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

6 Stock Maintenance

Program:

Create table stock (product_id varchar(5) primerykey , p_name


varchar(10) , p_type vrachar(10) , p_quantity varchar(5),p_price
varchar(10))

If product;

Insert table stock (product_id = product_id, p_name = p_name ,


p_type = p_type , p_quantity = p_quantity , p_price = p_price );

Insert table stock (E987 , soap , type1, 12 , 40);


Insert table stock (A687 , washing power , type2, 22 , 50);
Insert table stock (R387 , pen , type3, 122 , 10);
Insert table stock (E957 , bucket , type4, 10 , 30);

1. Select * from table stock ;

If p_quantity = 0;
Delete from row stock row where id = product_id;

2. Delete from row stock row where product_id = A687;

3. Update from stock p_name = mat where product_id= E957;

20
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

4. Drop table stock ;

Output:

1.

product_id p_name p_type p_quantity p_price

E987 soap type1 12 40

A687 washing type2 22 50


power

R387 pen type3 122 10

E957 bucket type4 10 30

2. Table row delete

3. Table row updated

4. Table droped

21
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

7 Online reservation system

Create table railway( id varchar(5) primerykey , c_name


varchar(5), train_no varchar(5) , si_no varchar(5), )

Insert table railway(234 , roy , D8854, 12 );


Insert table railway(222 , raj, D9754, 45);
Insert table railway(167 , joe, D4554, 30);

1. Select * from table railway;

2. Alter table railway add coloumn travellig_to;

3. Update from railway p_name = akhilwhere product_id= 167;

4. Drop table railway;

22
Downloaded by Chaithra C S Hirematt ([email protected])
lOMoARcPSD|44203781

Output :

1.

id c_name train_no si_no

234 roy D8854 12

222 raj D9754 45

167 joe D4554 30

2.

id c_name train_no si_no travellig_to

234 roy D8854 12 kochi

222 raj D9754 45 chennai

167 joe D4554 30 Kannur

3. Table row updated

4. Table drop

23
Downloaded by Chaithra C S Hirematt ([email protected])

You might also like