You are on page 1of 35

Lab 1: program /* frequency */

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int n, i, a[10], ele, freq;
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the size of an array ";
cin>>n;
cout<<endl<<"Enter the element into an array ";
for(i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the search element ";
cin>>ele;
}
void flag :: find()
{
freq=0;
for(i=0; i<n; i++)
if(a[i] == ele)
freq++;
}
void flag :: display()
{
if(freq >= 0)
cout<<endl<<"Frequence of "<<ele<<" is "<<freq;
else
cout<<endl<<ele<<" does not exist ";
}

void main()
{
// clrscr();
flag F;
F.read();
F.find();
F.display();
getch();

======end======
Lab 2: program /* insert an element into an array */
#include<iostream.h>
#include<process.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10], ele, p;
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the size of an array ";
cin>>n;
cout<<endl<<"Enter the element into an array ";
for(i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the element to be inserted ";
cin>>ele;
cout<<"Enter the postion ";
cin>>p;
}
void flag :: find()
{
if(p>n)
{
cout<<endl<<" Invalid Position ";
exit(0);
}
else
{
for(i=n-1; i>=p; i--)
a[i+1] =a[i];
a[p]=ele;
n++;
cout<<endl<<ele<<" is sucessfully inserted "<<endl;
}

}
void flag :: display()
{
cout<<endl<<"The array is "<<endl;
for(i=0; i<n; i++)
cout<<setw(4)<<a[i];
}

void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();

}
======end======
Lab 3: program /* delete an element from an array */

#include<iostream.h>
#include<process.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10], ele, p;
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the size of an array ";
cin>>n;
cout<<endl<<"Enter the element into an array ";
for(i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the postion ";
cin>>p;
}
void flag :: find()
{
if(p>n-1)
{
cout<<endl<<" Invalid Position ";
exit(0);
}
else
{
ele=a[p];
for(i=p; i<n; i++)
a[i] =a[i+1];
n--;
cout<<endl<<ele<<" is sucessfully removed "<<endl;
}

}
void flag :: display()
{
cout<<endl<<"The array is "<<endl;
for(i=0; i<n; i++)
cout<<setw(4)<<a[i];
}
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();

}
======end======

Lab 4: program /* insertion sort of an array element*/


#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10];
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the size of an array ";
cin>>n;
cout<<endl<<"Enter the element into an array ";
for(i=0; i<n; i++)
cin>>a[i];
}
void flag :: find()
{
int temp, j;
for(i=1; i<n; i++)
{
j=i;
while(j>=1)
{ if(a[j]<a[j-1])
{
temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
j--;
}
}
}
void flag :: display()
{
cout<<endl<<"The array is "<<endl;
for(i=0; i<n; i++)
cout<<setw(4)<<a[i];
}

void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();

======end======
Lab 5: program /* binary search */
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10], ele, loc;
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the size of an array ";
cin>>n;
cout<<endl<<"Enter the element into an array ";
for(i=0; i<n; i++)
cin>>a[i];
cout<<endl<<"Enter the search element ";
cin>>ele;
}
void flag :: find()
{
int beg, end, mid;
loc = -1;
beg = 0;
end = n-1;
while(beg<=end)
{
mid=(beg+end)/2;
if(ele == a[mid])
{
loc = mid;
break;
}
else
if(ele < a[mid])
end = mid - 1;
else
beg = mid + 1;
}
}
void flag :: display()
{ if(loc >= 0)
cout<<endl<<ele<<" is found at "<<loc<<" in an array ";
else
cout<<endl<<ele<<" is not found ";
}

void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();

======end======
Lab 6: program /* simple interest */

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int p,t,r,s;
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the value for P,R,T ";
cin>>p>>t>>r;
}
void flag :: find()
{
s=(p*t*r)/100;
}
void flag :: display()
{
cout<<endl<<" Principle "<<p;
cout<<endl<<" Time "<<t;
cout<<endl<<" Rate "<<r;
cout<<endl<<" Simple Interest is "<<s;
}

void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();

======end======

Lab 7: program /* determinants */


#include<iostream.h>
#include<iomanip.h>
#include<process.h>
#include<math.h>
#include<conio.h>
class flag
{
float a,b,c,r1,r2,d;
public:
void read();
void find();
void display();
};

void flag :: read()


{
cout<<"Enter the value for P,R,T ";
cin>>a>>b>>c;
}
void flag :: find()
{
d=(b*b)-(4*a*c);
if(d==0)
{
cout<<endl<<" Roots are equal ";
r1=(-b-sqrt(d))/(2*a);
r2=r1;
}
else
if(d>0)
{
cout<<endl<<" Roots are positive and different";
r1=(-b+sqrt(d))/(2*a);
r2=(-b-sqrt(d))/(2*a);
}
else
{
cout<<endl<<" Roots are Imaginary";
exit(0);
}
}
void flag :: display()
{
cout<<endl<<" First Root "<<r1;
cout<<endl<<" Second Root "<<r2;
}

void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
}
======end======
Lab 8: program /* function overloading */
#include<iostream.h>
#include<iomanip.h>
#include<math.h>
#include<conio.h>
class flag
{
float s;
public:
double area(double a)
{ return a*a; }
double area(double a, double b)
{ return a*b; }
double area(double a, double b, double c)
{ s=(a+b+c)/2;
return(sqrt(s*(s-a)*(s-b)*(s-c)));
}
};

void main()
{
double x,y,z;
int ch;
flag F;
clrscr();
cout<<endl<<" 1. Area of a Square 2. Area of Rectangel 3. Area of traingle ";
cout<<endl<<" Enter you choice ";
cin>>ch;
if(ch==1)
{
cout<<endl<<"Enter one side ";
cin>>x;
cout<<endl<<"Area of a Square is "<<F.area(x);
}
else
if(ch==2)
{
cout<<endl<<"Enter two side ";
cin>>x>>y;
cout<<endl<<"Area of a Rectangle is "<<F.area(x,y);
}
else
if(ch==3)
{
cout<<endl<<"Enter Three side ";
cin>>x>>y>>z;
cout<<endl<<"Area of a Triangle is "<<F.area(x,y,z);
}
else
cout<<endl<<"Invalid Input";
getch();
}

======end======
Lab 9: program /* inline function */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int n;
public:
flag(int m) // in this constructor we have one argument
{
n= m;
}
int cube();
};
inline int flag::cube()
{
return (n*n*n);
}

void main()
{
int n;
clrscr();
cout<<endl<<" Enter a number ";
cin>>n;
flag F = n; // here we are assigning n value directly to the object because it has only one
argument in the member function
cout<<endl<<" Cube of "<<n<< " is "<<F.cube();
getch();
}

======end======
Lab 10: program /* Sum of the series */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int i, x, n;
public:
double find();
flag(int a, int b)
{
x =a;
n=b;
}
};
double flag :: find()
{
int term;
int sum = 1;
term = x;
for(i=1; i<=n; i++)
{
sum=sum+term;
term = term*x;
}
return sum;
}

void main()
{
int x, n;
clrscr();
cout<<endl<<" Enter base value and power ";
cin>>x>>n;
flag F(x,n);
flag S =F;
cout<<endl<<" Object1 : sum of the series is "<<F.find();
cout<<endl<<" Object2 : sum of the series is "<<S.find();
getch();

}
======end======
Lab 11: program /* inheritance */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int roll;
char name[40];
public:

void read()
{
cout<<"Enter the Student name ";
cin.getline(name,30);
cout<<endl<<"Enter the Student Register Number ";
cin>>roll;
}
void display()
{
cout<<endl<<" Struent Register Number "<<roll;
cout<<endl<<" Student Name "<<name;
}
};
class sample : public flag
{
int m1,m2, total;
public:

void read2()
{
cout<<"Enter 2 subject marks ";
cin>>m1>>m2;
total=m1+m2;
}
void display2()
{
cout<<endl<<" Subject1 "<<m1;
cout<<endl<<" Subject2 "<<m2;
cout<<endl<<" Total "<<total;
}
};

void main()
{
clrscr();
sample F;
F.read();
F.read2();
F.display();
F.display2();
getch();

======end======
Lab 12: program /* pointers */
/* pointer */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
float r,h,v;
public:
void read();
void display();
};

void flag :: read()


{
cout<<"Enter the Student name ";
cin.getline(name,30);
cout<<endl<<"Enter the Student Register Number ";
cin>>roll;
cout<<"Enter the Student Fees ";
cin>>fee;
}
void flag :: display()
{
cout<<endl<<" Student Name "<<name;
cout<<endl<<" Struent Register Number "<<roll;
cout<<endl<<" Student Fee "<<fee;
}

void main()
{
clrscr();
flag F;
F.read();
F.display();
getch();

======end======
Lab 13: program /* stack */

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<ctype.h>
#define MAX 10

class flag
{
int a[MAX];
int i, top;
public:
flag()
{
top = -1;
}
void push(int ele)
{
if(top == MAX-1)
{
cout<<endl<<"Stack is full ";
return;
}
top++;
a[top]=ele;
cout<<endl<<ele<<" is pushed in to Stack";
}
void display()
{
if(top != -1)
{
cout<<endl<<" Stack Contains ";
for( i=0; i<=top; i++)
cout<<setw(4)<<a[i];
}
else
cout<<endl<<" Stack is empty";
}
};
void main()
{
flag F;
char ch;
int ele;
clrscr();
F.display();
cout<<endl<<" Do you want to push an element (Y/n)? ";
cin>>ch;
while(toupper(ch) == 'Y')
{
cout<<endl<<" Enter a number ";
cin>>ele;
F.push(ele);
F.display();
cout<<endl<<" Do you want to push nother element into stack (Y/N)? ";
cin>>ch;
}
getch();
}

======end======
Lab 14: program /* push */

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#define MAX 10

class flag
{
int a[MAX];
int top;
public:
flag()
{
top = -1;
}
void push(int ele)
{
if(top == MAX-1)
{
cout<<endl<<"Stack is full ";
return;
}
top++;
a[top]=ele;
cout<<endl<<ele<<" is pushed in to Stack";
}
void display()
{
if(top != -1)
{
cout<<endl<<" Stack Contains ";
for(int i=0; i<=top; i++)
cout<<setw(4)<<a[i];
}
else
cout<<endl<<" Stack is empty";
}
void pop()
{
if(top == -1)
{
cout<<endl<<"Stack is empty ";
return;
}
else
{
int data = a[top];
top--;
cout<<endl<<data<<" is poped from the stack";
}
}
};
void main()
{
flag F;
clrscr();
F.display();
F.push(10);
F.display();
F.push(20);
F.display();
F.push(30);
F.display();
F.pop();
F.display();
getch();
}
======end======
Lab 15: program /* queue */

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#define MAX 10

class flag
{
int q[MAX];
int first,last;
int count;
public:
flag();
void enqueue(int x);
int dequeue();
void display();
};
flag :: flag()
{
first = 0;
last = MAX-1;
count = 0;
}
void flag :: enqueue(int x)
{
last = (last+1) % MAX;
q[last] = x;
cout<<endl<<x<<" is inserted ";
count++;
}
int flag :: dequeue()
{
int x = q[first];
first=(first+1) % MAX;
count--;
cout<<endl<<x<<" is deleted ";
return x;
}
void flag :: display()
{
if(count > 0)
{
cout<<endl<<" Queue contains ";
for(int i=first; i<=last; i++)
cout<<q[i]<<setw(4);
}
else
cout<<endl<<" Queue is empty";
}
void main()
{
flag F;
clrscr();
F.display();
F.enqueue(10);
F.display();
F.enqueue(20);
F.display();
F.enqueue(30);
F.display();
F.dequeue();
F.display();
getch();
}
======end======
Lab 16: program /* lined list */

/* linked list*/
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class link
{

struct Node
{
int data;
Node *link;
}*START;

public:
link();
void print();
void append(int num);
void count();
};

link::link()
{
START = NULL;
}

void link::print()
{
if (START == NULL)
{
cout<<endl<<"Linked list is empty"<<endl;
return;
}

cout<<"Linked List Contins ";


Node *tmp = START;
while(tmp != NULL)
{
cout<<tmp->data<<" ";
tmp=tmp->link;
}
}
void link::append(int num)
{
Node *p;
p = new Node;
p->data = num;
p-> link = NULL;
if(START == NULL)
{
START = p;
cout<<endl<<num<<" is inserted as the first node"<<endl;
}
else
{
Node *n = START;
while(n->link != NULL)
n = n->link;
n->link = p;
cout<<endl<<num<<" is inserted"<<endl;
}
}
void link:: count()
{
Node *tmp;
int c=0;
for(tmp = START; tmp != NULL; tmp = tmp->link)
c++;
cout<<endl<<"Number of nodes in a linked list is "<<c<<endl;
}
void main()
{
clrscr();
link *obj = new link();
obj->print();
obj->append(20);
obj->print();
obj->count();
obj->append(30);
obj->print();
obj->count();
obj->append(40);
obj->print();
obj->count();
getch();
}
======end======
SQL -1

1. Create a table for house hold Electricity bill with the following:-
SQL> create table electricity (rr-num varchar(8), number char(8), billing date, units number(4));

2. Command to add record(tuple) into the table.

SQL> insert into electricity values('A101','Manju','12-Feb-2022',34);

SQL> insert into electricity values('A102','Reeta','14-Mar-2022',144);

SQL> insert into electricity values('A103','Vikas','23-Jun-2022',100);

SQL> insert into electricity values('A203','Nithin','23-Aug-2022',29);

3. Command to add two new fields to the table

SQL> alter table electricity add( amount number(6,2), due date);

4. Command to compute bill amount

SQL>update electricity set amount = 50;

SQL> update electricity set amount =amount + 100*4.50+(unit-100)*5.50 where units>100;

SQL> update electricity set amount =amount + 100*4.50 where units<=100;

SQL> update electricity set due = billing +15;

5. Command to view the bill statement

SQL> select * from electricity;

OUTPUT:- take print out and past it in un-rule page


RR_NUM NAME BILLLING UNITS AMOUNT DUE

---------------------------------------------------------------------------------------------------------

A101 Manju 12-FEB-22 34 1314.00 27-Feb-22

A102 Reeta 14-MAR-22 144 742.00 29-Mar-22

A103 Vikas 23-JUN-22 100 1380.00 08-JUN-22

A203 Nithin 23-AUG-22 29 1309.00 07-SEP-22

======end======
SQL -2
Create s student data base and compute the result
1. Create a table: -
SQL> create table stud (id number(4), name varchar(20), sub1 number(3), sub2
number(3), sub3 number(3), sub4 number(3), sub5 number(3), sub6 number(3));

2. Insert 5 record(tupe) into the table: -


SQL> insert into stud values (125, 'Anu', 67,89,78,56,45,67);
SQL> insert into stud values (126, 'Kavya', 97,69,68,86,65,97);
SQL> insert into stud values (128, 'Bhuvan', 100,69,86,95,99);
SQL> insert into stud values (127, 'Zain',54,34,76,26,45,69);
SQL> insert into stud values (124, 'Santhosh',99,34,99,99,99,99)

3. Command to alter the table:-


i. Add 3 column such as total, percentage and result
SQL> alter table stud add( total number(3), per number(5,2), result char(6)) ;
ii. Update the total
SQL> update stud set total = sub1 + sub2 +sub3 + sub4 + sub5 + sub6;
iii. Update the percentage
SQL> update stud set per = total/6.0;
iv. Update the result either pass or fail
SQL> update stud set result = 'Pass' where sub1>=35 and sub2>=35 and sub3>=35
and sub4>=35 and sub5>=35 and sub6>=35;
SQL> update stud set result = 'Fail' where sub1<35 or sub2<35 or sub3<35 or sub4<35
or sub5<35 or sub6<35;

4. Command to display the stud table


SQL> select * from stud ;

OUTPUT:- take print out and past it in un-rule page


ID NAME SUB1 SUB2 SUB3 SUB4 SUB5 SUB6 TOTAL PER RESULT
-----------------------------------------------------------------------------------------------------------------
125 Anu 67 89 78 56 45 67 402 67.00 Pass
126 Kavya 97 69 68 86 65 97 482 80.33 Pass
128 Bhuvan 100 69 86 86 95 99 535 89.17 Pass
127 Zain 54 34 76 26 45 69 304 50.67 Fail
124 Santhosh 99 34 99 99 99 99 529 88.17 Fail
5. Command to display the only id and name from the stud table
SQL> select id, name from stud;
OUTPUT:- take print out and past it in un-rule page

ID NAME
-----------------------------
125 Anu
126 Kavya
128 Bhuvan
127 Zain
124 Santhosh

6. Command to list the student who have passed


SQL> select * from stud where result = 'Pass';

OUTPUT:- take print out and past it in un-rule page


ID NAME SUB1 SUB2 SUB3 SUB4 SUB5 SUB6 TOTAL PER RESULT
-----------------------------------------------------------------------------------------------------------------
125 Anu 67 89 78 56 45 67 402 67.00 Pass
126 Kavya 97 69 68 86 65 97 482 80.33 Pass
128 Bhuvan 100 69 86 86 95 99 535 89.17 Pass

7. Command to list the student who have failed


SQL> select * from stud where result = 'Fail';
OUTPUT:- take print out and past it in un-rule page
ID NAME SUB1 SUB2 SUB3 SUB4 SUB5 SUB6 TOTAL PER RESULT
-----------------------------------------------------------------------------------------------------------------
127 Zain 54 34 76 26 45 69 304 50.67 Fail
124 Santhosh 99 34 99 99 99 99 529 88.17 Fail

8. Count the number of the student who have passed


SQL> select count(*) from stud where result ='Fail';

OUTPUT:- take print out and past it in un-rule page


count(*)
-------------------
2
9. Count the number of the student who have passed
SQL> select count(*) from stud where result ='Fail';

OUTPUT:- take print out and past it in un-rule page


count(*)
-------------------
3

10. Command to list the student who have passed


SQL>select * from stud where per >=60;

OUTPUT:- take print out and past it in un-rule page


ID NAME SUB1 SUB2 SUB3 SUB4 SUB5 SUB6 TOTAL PER RESULT
-----------------------------------------------------------------------------------------------------------------
125 Anu 67 89 78 56 45 67 402 67.00 Pass
126 Kavya 97 69 68 86 65 97 482 80.33 Pass
128 Bhuvan 100 69 86 86 95 99 535 89.17 Pass
124 Santhosh 99 34 99 99 99 99 529 88.17 Fail

11. Command to sort the student list according to the student id


SQL> select * from stud order by id;

OUTPUT:- take print out and past it in un-rule page


ID NAME SUB1 SUB2 SUB3 SUB4 SUB5 SUB6 TOTAL PER RESULT
-----------------------------------------------------------------------------------------------------------------
124 Santhosh 99 34 99 99 99 99 529 88.17 Fail
125 Anu 67 89 78 56 45 67 402 67.00 Pass
126 Kavya 97 69 68 86 65 97 482 80.33 Pass
127 Zain 54 34 76 26 45 69 304 50.67 Fail
128 Bhuvan 100 69 86 86 95 99 535 89.17 Pass

======end======

SQL -3

1. Generate the employee and computer the salary based on the department

SQL> create table employee ( emp_id number(4), dept_id number(4), name varchar(20),
salary number(8));

2. Add 4 record (tuple) into the employee table


SQL> insert into employee values (1009, 01,'Arun', 25000);

SQL> insert into employee values (1026, 02,'Priya', 35000);

SQL> insert into employee values (1238, 03,'Surya', 45000);

SQL> insert into employee values (1555, 04,'Keerthi', 15000);

3. Command to list all details of employee

SQL> select * from employee;

OUTPUT:- take print out and past it in un-rule page


EMP-ID DEPT_ID NAME SALARY

-------------- --------------- ------------- ------------------

1009 1 Arun 25000

1026 2 Priya 35000

1238 3 Surya 45000

1555 4 keerthi 15000

6731 2 Rahul 25400

4. Generate the employee and computer the salary based on the department

SQL> create table dept ( dept_id number(4), name varchar(20), supervisor char(12));

5. Add 4 record (tuple) into the dept table

SQL> insert into dept values (01, 'Purchase', 'ammen');

SQL> insert into dept values (02, 'Account', 'Reddy' );

SQL> insert into dept values (03,'Sales', 'Mehra' );

SQL> insert into dept values (04, 'Apprentice' , 'Ashish' );

6. Command to list all details of dept

SQL> select * from dep;

OUTPUT:- take print out and past it in un-rule page


DETP_ID NAME SUPERVISOR

------------------ -------------- -------------------


1 Purchase Ameen

2 Account Reddy

3 Sales Mehra

4 Apprentice Ashish

7. Command to find the name of all employee who works for the account department.

SQL> select * from employee where dept_id = ( select dept_id from dept where name='Account');

OUTPUT:- take print out and past it in un-rule page


EMP-ID DEPT_ID NAME SALARY

-------------- --------------- ------------- ------------------

1026 2 Priya 35000

6731 2 Rahul 25400

8. Command to find the number of employee who works for the account department.

SQL> select count( *) from employee where dept_id = ( select dept_id from dept where
name='Account');

OUTPUT:- take print out and past it in un-rule page


COUNT (*)

----------------

9. Command to find minimum, maximum and average slaary of the employee who works for the
account department.

SQL> select min(salary) from employee where dept_id = ( select dept_id from dept where
name='Account');

OUTPUT:- take print out and past it in un-rule page


MIN (SALARY)

--------------------

25400

SQL> select max(salary) from employee where dept_id = ( select dept_id from dept where
name='Account');

OUTPUT:- take print out and past it in un-rule page


MAX (SALARY)
--------------------

35000

SQL> select avg(salary) from employee where dept_id = ( select dept_id from dept where
name='Account');

OUTPUT:- take print out and past it in un-rule page


AVG (SALARY)

--------------------

30200

10. Command to list the employees working for particular supervisor.

SQL> select * from employee where dept_id = ( select dept_id from dept where
SUPERVISOR='Mehra'');

OUTPUT:- take print out and past it in un-rule page


EMP-ID DEPT_ID NAME SALARY

-------------- --------------- ------------- ------------------

1238 3 Surya 45000

11. Command to retrieve the department name for each department name for each department
where only two works.

SQL> select name from dept where dept_id = ( select dept_id from employee group by dept-id
having count(*)=2');

OUTPUT:- take print out and past it in un-rule page


Name

-----------------

Account

12. Command to increase the salary of all employee in the sales department by 15%.

SQL> update employee set salary = salary + salary * 0.15 where dept_id = ( select dept_id from
dept where name='Sales');

1 row updated.

i. Command to list employee who dept_id =3;

SQL> select * from emp;

OUTPUT:- take print out and past it in un-rule page


EMP-ID DEPT_ID NAME SALARY

------------- -------------- -------------- ---------------

1238 3 Surya 51750

13. Command to add a new column to the table employee called bonus and compute 5% of the
salary to the said field.

SQL> alter table employee add bonus number(8);

SQL> select * from employee;

OUTPUT:- take print out and past it in un-rule page


EMP-ID DEPT_ID NAME SALARY BONUS

-------------- --------------- ------------- ------------------ -------------

1009 1 Arun 25000 1250

1026 2 Priya 35000 1750

1238 3 Surya 51750 2588

1555 4 keerthi 15000 750

6731 2 Rahul 25400 1270

14. Command to delete all the row for employee in the apprentice department.

SQL> delete from employee where dept_id = (select dept_id from where name = 'Apprentice');

1 row deleted.

i. Command to list employee;

SQL> select * from emp;

OUTPUT:- take print out and past it in un-rule page


EMP-ID DEPT_ID NAME SALARY

-------------- --------------- ------------- ------------------

1009 1 Arun 25000

1026 2 Priya 35000

1238 3 Surya 51750

6731 2 Rahul 25400

======end======
SQL -4

1. Create database for the bank transaction.


i. Create customer table
SQL> create table customer (cno number(4) primary key, cname char(14), caddress varchar(20),
cphone char(12));

SQL> desc customer;

OUTPUT:- take print out and past it in un-rule page

NAME NULL? TYPE

--------------------- --------------------- ----------------------------

CNO NOT NULL NUMBER(4)

CNAME CHAR(14)

CADDRESS VARCHAR(20)

CPHONE CHAR(12)

ii. Create back table

SQL> create table bank (accno number(8) not null, tramount number98), trdate date, trtype
char, cno number(4));

SQL> desc bank;

OUTPUT:- take print out and past it in un-rule page

NAME NULL? TYPE

------------ --------------------- ------------------

ACCNO NOT NULL NUMBER(8)

TRAMOUNT NUMBER(8)

TRADATE DATE

TRTYPE CHAR

CNO NUMBER(4)

2. Command to insert record to the customer table

SQL> insert into customer values ( 100,'anush','bangalore','25552');

SQL> insert into customer values ( 101,'ganes','hubli','36545')


SQL> insert into customer values ( 102,'kiran','mysore','78564');

SQL> select * from customer;

3. Command to list all the record for customer table.

OUTPUT:- take print out and past it in un-rule page

CNO CNAME CADDRESS CPHONE

-------- ------------- ----------------------- ------------------

100 anush Bangalore 25552

101 ganes hubli 36545

102 kiran mysore 78564

4. Command to insert record to the bank table

SQL> insert into bank values ( 1300, 2396, '01-MAR-2022', 'D' , 100);

SQL> insert into bank values ( 13101, 7000, '26-MAR-2022', 'C' , 100);

SQL> insert into bank values ( 13102, 2400, '01-JAN-2022', 'C' , 102);

SQL> insert into bank values ( 13103, 5968, '14-FEB-2022', 'D' , 103);

5. Command to list all the record for customer table.

SQL> select * from bank;

OUTPUT:- take print out and past it in un-rule page

ACCNO TRAMOUNT TRDATE CNO

---------------- ---------------------- --------------------- ---------------

1300 2396 01-MAR-22 100

13101 7000 26-MAR-22 100

13102 2400 21-JAN-22 102

13103 5968 14-FEB-22 103

6. Check trdate equal to and greater than ‘01-MAR-2022’

SQL> select * from bank where trdate='01-mar-2022' and trdate>'01-mar-2022';


no rows selected

7. Check trdate only greater than ‘01-MAR-2022’

SQL> select * from bank where trdate>='01-mar-2022';

OUTPUT:- take print out and past it in un-rule page

ACCNO TRAMOUNT TRDATE TRTYPE CNO

----------- -------------------- ------------------- ------------- ------------

1300 2396 01-MAR-22 D 100

13101 7000 26-MAR-22 C 100

8. Join the 2 tables customer and bank.

SQL>select bank.accno, customer.cno from customer, bank where customer.cno=banck.cno;

OUTPUT:- take print out and past it in un-rule page

ACCNO CNO

------------- --------------

1300 100

13101 100

13102 102

9. List and count for trdates

SQL> select trtype, count(*) from bank group by trtype;

OUTPUT:- take print out and past it in un-rule page

TRTYPE COUNT(*)
--------------- ---------------

D 2

C 2

10. Delete a row from table bank.

SQL> delete from bank where accno=1300;

1 row delete.

11. List cno number which is uniqu in the table

SQL> select distinct (cno) from bank;

OUTPUT:- take print out and past it in un-rule page

CNO

---------------

100

102

103

12. Create view name as SEE only 2 attribute such as cno, cphone from costomer

SQL> create view SEE as select cno, cphone from customer;

view created.

13. Command to display the create view

SQL> select * from see;

OUTPUT:- take print out and past it in un-rule page

CNO CPHONE

---------------- -----------------

100 25552

101 36545

102 78564

14. Command to list all the cname by descending order.

SQL>select cname from customer order by cname desc;

OUTPUT:- take print out and past it in un-rule page


CNAME

--------------

kiran

ganes

anush

======end======

HTML 01
Write a html program to create a student time table.

<! doctype html>


<html>
<head>
<style>
td,th, table
{
border:1px solid black;
}
</style>
</head>
<body>
<h1> <center> <color="blue"> MY STUDY TIME_TABLE FOR THE WEEK</color></center></h1>
<h2><center> Beautiful Sunrise</center></h2>
<img border="1" src="d:\kk.jpg" width="304" height="228">
<table style="width:900px">
<tr>
<th>Days</th>
<th>Subject</th>
<th>Morning Study time only reading</th>
<th>College Study time </th>
<th> Evening Study time writing</th>
<th> Question paper solution Time only writing</th>
</tr>
<tr>
<th>Monday</th>
<th>Lang I</th>
<th> 5:00 - 6:30 A.M </th>
<th> 8:30 - 4:00 P.M </th>
<th> 6:00 - 8:30 P.M </th>
<th> 9:00 - 11:00 P.M</th>
</tr>
<th>Tuesday</th>
<th>Lang II</th>
<th> 5:00 - 6:30 A.M </th>
<th> 8:30 - 4:00 P.M </th>
<th> 6:00 - 8:30 P.M </th>
<th> 9:00 - 11:00 P.M</th>
</tr>
<th>Wednesday</th>
<th>Optional I</th>
<th> 5:00 - 6:30 A.M </th>
<th> 8:30 - 4:00 P.M </th>
<th> 6:00 - 8:30 P.M </th>
<th> 9:00 - 11:00 P.M</th>
</tr>
<th>Thursday</th>
<th>Optional II</th>
<th> 5:00 - 6:30 A.M </th>
<th> 8:30 - 4:00 P.M </th>
<th> 6:00 - 8:30 P.M </th>
<th> 9:00 - 11:00 P.M</th>
</tr>
<th>Friday</th>
<th>Optional III</th>
<th> 5:00 - 6:30 A.M </th>
<th> 8:30 - 4:00 P.M </th>
<th> 6:00 - 8:30 P.M </th>
<th> 9:00 - 11:00 P.M</th>
</tr>
<th>Saturday</th>
<th>Optional I Lang I</th>
<th> 5:00 - 6:30 A.M </th>
<th> 8:30 - 4:00 P.M </th>
<th> 6:00 - 8:30 P.M </th>
<th> 9:00 - 11:00 P.M</th>
</tr>
</table>
<marquee direction="right"> Enjoy life as a student !!</marguee>
</body>
</html>
======end======
HTML 02
Application Form

<html>
<body>
<h1><center>Application Form</center></h1>
<form>

First Name:<input type="text" value="ram"><br><br>


Last Name:<input type="text" value="kumar"><br><br>
Password:<input type="password"><br><br>
Hidden Field:<input type="hidden"><br><br>

Address:<textarea rows="5" cols="20">


My College Name,
My College Address

</textarea>

<br><br>
<input type="checkbox" value="physics">Physics<br>
<input type="checkbox" value="chemistry">Chemistry<br>
<input type="checkbox" value="mathematics">Mathematics<br><br>
Gender:<br>

<input type="radio" value="male" name="gender">Male<br>


<input type="radio" value="female" name="gender">Female<br><br>
<select>
<option value="PU-I">PU-I</option>
<option value="PU-II">PU-II</option>
</select><br><br>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
<html>
<body>

<table border="2">
<tr>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
</tr>

<tr>
<td>physics</td>
<td>chemistry</td>
<td>mathematics</td>
<td>biology</td>
<td>kannada</td>
<td>sanskrit</td>
</tr>

<tr>
<td>english</td>
<td>hindi</td>
<td>computer science</td>
<td>mathematics</td>
<td>chemistry</td>
<td>physics</td>
</tr>

<tr>
<td>sanskrit</td>
<td>kannada</td>
<td>biology</td>
<td>physics</td>
<td>chemistry</td>
<td>mathematics</td>
</tr>

<tr>
<td>kannada</td>
<td>physics</td>
<td>mathematics</td>
<td>biology</td>
<td>chemistry</td>
<td>mathematics</td>
</tr>

</table>
</body>

Output: -

======end======

You might also like