Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

LAB PROGRAMS

Uploaded by

madan01mady
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

LAB PROGRAMS

Uploaded by

madan01mady
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

sql

program-1
Generate the electricity bill for one customer. Create a table for house hold Electricity bill with the
following fields.
FieldName Type
RR_NO VARCHAR2(10)
CUS_NAME VARCHAR2(15)
BILLING_DATE DATE
UNITS NUMBER(4)
Insert 10 records into the table.
1. Check the structure of table and note your observation.
2. Add two fields to the table.
a. BILL_AMT NUMBER(6,2)
b. DUE_DATE DATE
3. Compute the bill amount for each customer as per the following rules.
a. MIN_AMT Rs. 50
b. First 100 units Rs 4.50/Unit
c. >100 units Rs. 5.50/Unit
4. Compute due date as BILLING_DATE + 15 Days
5. List all the bills generated

create table ebill(rrno varchar2(10),cname varchar2(10),billingdate date ,units number(10));

insert into ebill values('a10001','akash','1-jan-2023',50);

insert into ebill values('a10002','ankitha','1-feb-2023',110);

insert into ebill values('a10003','akshitha','1-march-2023',140);

insert into ebill values('a10004','aiswarya','1-may-2023',240);

insert into ebill values('a10005','adarsh','1-june-2023',180);

desc ebill;

alter table ebill add(billamt number(6,2),duedate date);


select * from ebill;

update ebill set billamt=50;

update ebill set billamt=50+units*4.50 where units<=100;

update ebill set billamt=billamt+100*4.50 +(units-100)*5.50 where units >=100;

update ebill set duedate=billingdate+15;

select * from ebill;

program-2
Create a student database and compute the results.
Create a table for class of students with the following fields.
Field Name Type
ID_NO NUMBER(4)
S_NAME VARCHAR2(15)
SUB1 NUMBER(3)
SUB2 NUMBER(3)
SUB3 NUMBER(3)
SUB4 NUMBER(3)
SUB5 NUMBER(3)
SUB6 NUMBER(3)
1. Add records into the table for 10 students for Student ID, Student Name and marks in 6 subjects
using INSERT command.
2. Display the description of the fields in the table using DESC command.
3. Alter the table and calculate TOTAL and PERC_MARKS.
4. Compute the RESULT as “PASSP or “FAIL” by checking if the student has scored more than 35 marks in
each subject.
5. List the contents of the table.
6. Retrieve all the records of the table.
7. Retrieve only ID_NO and S_NAME of all the students.
8. List the students who have result as “PASS”.
9. List the students who have result as “FAIL”.
10. Count the number of students who have passed.
11. Count the number of students who have failed.
12. List the students who have percentage greater than 60.
13. Sort the table according to the order of ID_NO.

create table stud(sid number(4),sname varchar2(10),sub1 number(3),sub2 number(3),sub3


number(4),sub4 number(4),sub5 number(3),sub6 number(3));
insert into stud values(101,'akash',28,38,29,10,37,28);

insert into stud values(102,'abhishek',88,78,39,90,87,88);

insert into stud values(103,'navven',78,88,29,94,87,89);

insert into stud values(104,'ankitha',98,87,76,34,45,77);

insert into stud values(105,'deeraj',28,37,36,44,50,50);

select * from stud;

alter table stud add(total number(10),percen number(10),result varchar2(10));

desc stud;

update stud set total=sub1+sub2+sub3+sub4+sub5+sub6;

update stud set percen=total/6;

select *from stud;

update stud set result='pass' where (sub1>=35 and sub2>=35 and sub3>=35 and sub4>=35 and
sub5>=35 and sub6>=35);

update stud set result='fail' where(sub1<35 or sub2<35 or sub3<35 or sub4<35 or sub5<35 or sub6<35);

select *from stud;

select sid,sname from stud;

select *from stud where result='fail';

select *from stud where result='pass';

select count(*) from stud where result='pass';


select count(*) from stud where result='fail';

select * from stud where percen>=60;

select * from stud order by sid;

program-3
Generate the Employee details and compute the salary based on the department.
Create the following table EMPLOYEE.
FieldName Type
EMP_ID NUMBER(4)
DEPT_ID NUMBER(2)
EMP_NAME VARCHAR2(10)
EMP_SALARY NUMBER(5)

Create another table DEPARTMENT.


FieldName Type
DEPT_ID NUMBER(2)
DEPT_NAME VARCHAR2(10)
SUPERVISOR VARCHAR2(10)

Enter 10 rows of data for table EMPLOYEE and 4 rows of data for DEPARTMENT table.

1. Find the names of all employees who work for the Accounts department.
2. How many employees work for Accounts department?
3. What are the Minimum, Maximum and Average salary of employees working for Accounts
department?
4. List the employees working for particular supervisor.
5. Retrieve the department names for each department where only one employee works.
6. Increase the salary of all employees in the sales department by 15%.
7. Add a new Colum to the table EMPLOYEE called BONUS NUMBER (5) and compute 5% of
the salary to the said field.
8. Delete all the rows for the employee in the Apprentice department.

create table employee(empid number(4),deptid number(2),empname varchar2(25),empsalary


number(5));

desc employee;

insert into employee values(1001,1,'akash',40000);


insert into employee values(1002,2,'ankitha',50000);

insert into employee values(1003,3,'adarsh',60000);

insert into employee values(1004,4,'amulya',45000);

insert into employee values(1005,5,'adithya',23000);

create table department(deptid number(2),deptname varchar2(20),supervisor varchar2(20));

insert into department values(1,'hr','keerthana');

insert into department values(2,'purchase','keerthi');

insert into department values(3,'sales','deeraj');

insert into department values(4,'accounts','keerthi');

insert into department values(5,'apprentice','monika');

select * from employee where deptid=(select deptid from department where deptname='accounts');

select count(*) from employee where deptid=(select deptid from department where
deptname='accounts');

select min(empsalary)from employee where deptid=(select deptid from department where


deptname='accounts');

select max(empsalary)from employee where deptid=(select deptid from department where


deptname='accounts');

select avg(empsalary)from employee where deptid=(select deptid from department where


deptname='accounts');

select *from employee where deptid=(select deptid from department where supervisor='deeraj');

select deptname from department where deptid in(select deptid from employee group by deptid
having count(*)=1);
update employee set empsalary =empsalary+empsalary*0.15 where deptid=(select deptid from
department where deptname='sales');

alter table employee add bonus number(5);

update employee set bonus=empsalary*0.05;

delete from employee where deptid=(select deptid from department where deptname='apprentice');

program-4

create database for the bank transaction


create table customer from following deatails
field name datatype
cno number(4)
cname varchar2(20)
caddress varchar2(10)
cphone number(10)

create another table for bank


fieldname datatype
accno number(3)
tamt number(10)
ttype varchar2(10)
cno number(4)
tdate date
1.insert data values into customer table
2.insert data values into bank table
3.display all records for custoer table
4.display all records for bank table
5.dispaly all records for whose trasanction date
6.alter table customer to change the size of customer address
7.delete record from bank having a particular account number
8.display all records from customer whose name start from particular alphabet
9.display total transcation amount from bank table
10.display distinct customer number from bank
11.join two tables
12.display all records from customers orders by customer name in descending order
13.delete all records from customer bank
14.drop table bank
15.drop table customer
create table customer(cno number(4),cname varchar2(10),caddress varchar2(10),cphone number(10));

desc customer;

insert into customer values(101,'akash','mysore',987654398);

insert into customer values(102,'deeeraj','goa',987654399);

insert into customer values(103,'amulya','ankitha',98765436);

insert into customer values(104,'deeksha','mumbai',987654399);

insert into customer values(105,'ravindra','pune',987654349);

create table bank(accno number(10), cno number(4),tamt number(8,2),ttype varchar2(10),tdate date);

insert into bank values(12345,101,15000,'c','30-jan-2023');

insert into bank values(12347,102,34000,'d','31-jan-2022');

insert into bank values(123489,103,34600,'c','24-jul-2022');

insert into bank values(122489,104,44600,'d','7-aug-2022');

insert into bank values(122897,105,67000,'c','8-sep-2022');

select * from customer;

select * from bank;

select * from bank where tdate='08-sep-22';

alter table customer modify caddress char(50);

desc customer;
delete from bank where accno=12345;

select * from bank;

select * from customer where cname like'd%';

select sum(tamt)from bank;

select distinct cno from bank;

select accno ,customer.cno,cname from customer, bank where customer.cno=bank.cno;

select * from customer order by cname desc;

delete from customer;

drop table bank;

Html

PROGRAM 1:
Write a HTML program to create a study Time Table
<HTML>
<HEAD>
<TITLE> TIME TABLE </TITLE>
</HEAD>
<BODY TEXT=DARKBLUE>

<CENTER> <H4>STUDY TIME TABLE 2023-2024 </H4>


<TABLE BORDER=10 WIDTH=900 HEIGHT=200 BGCOLOR=CYAN CELLSPACING=2 CELLPADDING=15>

<CAPTION> <B> II PUC COMMERCE </B> <CAPTION>

<TR>

<TD ROWSPAN=2 ALIGN=CENTER> <B> DAY </B> </TD>

</TR>

<TR>
<TH> SUBJECTS </TH>
<TH> MORNING TIME READING ONLY </TH>
<TH> COLLEGE STUDY TIME</TH>
<TH>EVENING STUDY TIME</TH>
<TH>QUESTION PAPER SOLUTION TIME</TH>
</TR>

<TR>
<TH>MONDAY</TH>
<TD>ENGLISH</TD>
<TD>5.00 -6.30 AM</TD>
<TD>8.30 -4.30</TD>
<TD>6.30-8.30</TD>
<TD>9.30-11.00</TD>
<TR>
<TR>
<TH>TUESDAY</TH>
<TD>KANNADA</TD>
<TD>5.00 -6.30 AM</TD>
<TD>8.30 -4.30</TD>
<TD>6.30-8.30</TD>
<TD>9.30-11.00</TD>
<TR>
<TR>
<TH>WEDNESDAY</TH>
<TD>ENGLISH</TD>
<TD>5.00 -6.30 AM</TD>
<TD>8.30 -4.30</TD>
<TD>6.30-8.30</TD>
<TD>9.30-11.00</TD>
<TR>
<TR>
<TH>THURSDAY</TH>
<TD>ENGLISH</TD>
<TD>5.00 -6.30 AM</TD>
<TD>8.30 -4.30</TD>
<TD>6.30-8.30</TD>
<TD>9.30-11.00</TD>
<TR>
<TR>
<TH>FRIDAY</TH>
<TD>ENGLISH</TD>
<TD>5.00 -6.30 AM</TD>
<TD>8.30 -4.30</TD>
<TD>6.30-8.30</TD>
<TD>9.30-11.00</TD>
<TR>
<TR>
<TH>SATURDAY</TH>
<TD>ENGLISH</TD>
<TD>5.00 -6.30 AM</TD>
<TD>8.30 -4.30</TD>
<TD>6.30-8.30</TD>
<TD>9.30-11.00</TD>
<TR>

</TR>
</TABLE>
</CENTER>
</BODY>

PROGRAM 2:
Create an HTML program with Table and Form.

<HTML>
<HEAD>
<TITLE> ONLINE APPLICATION </TITLE>
</HEAD>
<BODY bgcolor=CYAN>

<FORM>

<H3 ALIGN=CENTER> FIRST PUC APPLICATION FORM </H3>


<center>
<TABLE border=1 CELLSPACING=5 CELLPADDING=5 >

<TR>
<TD> STUDENT NAME: </TD>
<TD><INPUT TYPE=”TEXT” NAME=STUNAME></TD>
</TR>

<TR>
<TD> FATHER NAME: </TD>
<TD><INPUT TYPE=”TEXT” NAME=FATNAME></TD>
</TR>

<TR>
<TD >DATE OF BIRTH: </TD>
<TD><INPUT TYPE=”TEXT” NAME=DOB></TD>
</TR>
<TR>

<TR>
<TD> CONTACT NO:</TD>
<TD><INPUT TYPE ="TEXT" NAME=CNO"></TD>
</TR>

<TR>
<TD>GENDER: </TD>
<TD>
<INPUT TYPE=RADIO NAME=GENDER VALUE=M>MALE
<INPUT TYPE=RADIO NAME=GENDER VALUE=F>FEMALE
</TD>
</TR>

<TR>
<TD> CATEGORY:</TD>
<td>
<SELECT NAME=DROPDOWN>
<OPTION>GM</OPTION>
<OPTION>SC</OPTION>
<OPTION>ST</OPTION>

</SELECT>
</TD>
</TR>

<TR>
<TD>SUBJECT CHOOSEN: </TD>
<TD>
<INPUT TYPE=CHECKBOX NAME=SUB1 >ECONOMICS
<INPUT TYPE=CHECKBOX NAME=SUB2 >BUISNESS
<INPUT TYPE=CHECKBOX NAME=SUB3 >ACCOUNTANCY
<INPUT TYPE=CHECKBOX NAME=SUB5 >COMP SCI
</TD>
</TR>

<TR>
<TD>
<INPUT TYPE="BUTTON" VALUE="SUBMIT THE FORM">
</TD>
<TD>
<INPUT TYPE="BUTTON" VALUE="RESET THE FORM">
</TD>
</TR>
</TABLE>
<FORM>
</BODY>
</HTML>

You might also like