LAB PROGRAMS
LAB PROGRAMS
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
desc 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.
desc 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);
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)
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.
desc employee;
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 *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');
delete from employee where deptid=(select deptid from department where deptname='apprentice');
program-4
desc customer;
desc customer;
delete from bank where accno=12345;
Html
PROGRAM 1:
Write a HTML program to create a study Time Table
<HTML>
<HEAD>
<TITLE> TIME TABLE </TITLE>
</HEAD>
<BODY TEXT=DARKBLUE>
<TR>
</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>
<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>