100% found this document useful (2 votes)
22K views68 pages

Computer Science Manual 2nd

manual of 2nd puc cs

Uploaded by

Nandan MG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
100% found this document useful (2 votes)
22K views68 pages

Computer Science Manual 2nd

manual of 2nd puc cs

Uploaded by

Nandan MG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 68
Practicals Manual Second Year PUC Computer Science REVISED EDITION © Department of Pre-University All Rights Are Reserved Education 2014-2015. No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, electronic, mechanical, photo copying, recording or otherwise without the prior permission of the publisher. Revised Edition - 2015 This book is sold subject to the condition that it shall not, by way of trade, be lent, resold, hired out or otherwise disposed of without the publisher's consent, in any form of binding or cover other than that in which itis published. The correct price of this publication is the price printed on this page/cover page. Any revised price indicated by a rubber stamp or by a sticker or by any other means is incorrect and should be unacceptable. . . The Karnataka Text Book Society Printed on 80 GSM Maplitho paper _| 400 feet Ring Road, Banashankari Ill Stage, BENGALURU - 560 085. Publisher: VINAYAKA OFFSET PRINTERS #56, 9th Main, 1st Cross, Kaverinagar, BSK II Stage, Banashankari Industrial Area Bengaluru 560 070. Mobile : 94480 58802 I PUC MANUAL 2 SECTIO! C++ Data structure List of programs to be conducted in practical sessions Write a program to find the frequency of presence an element in an array. Write a program to insert an element into an array at a given position. Write a program to delete an element from an array from a given position Write a program to sort the elements of an array in ascending order using insertion sort. Write a program to search for a given element in an array using Binary search method. 5. Write a program to create a class with data members principle, time and rate. Create member functions to accept data values to compute simple interest and to display the result. 7. Write a program to create a class with data members a, b, c and member functions to input data, compute the discriminant based on the following conditions and print the roots. > If determinant BONES oF , print the roots that are equal > If the discriminant is>0, print the real roots > _ Ifthe discriminant<0, print that the roots are imaginary . Program to find the area of a square/rectangle/triangle using function overloading. P. Program to find the cube of a number using inline functions. LO. Write a program to find the sum of the series 1+ x + x2 +... + x2 using constructors. l1. Create a base class containing the data members roll number and name. Also create a member function to read and display the data using the concept of single level inheritance. Create a derived class that contains marks of two subjects and total marks as the data members. l.2. Create a class containing the following data members register No., name and fees. Also create a member function to read and display the data using the concept of pointers to objects. l13. Write a program to perform push items into the stack. li4. Write a program to pop elements from the stack. IIS. Write a program to perform enqueue and dequeue. l16. Write a program t o create a linked list and appending nodes. Il PUC MANUAL 3 SECTION B - SQL 17. Generate the Electricity Bill for one consumer (Create a table for house hold Electricity bill with the following fields Field name type RR_number Varchar2(10) consumer_name | varchar2(25) date_billing Date units number(4) . Insert 10 records into the table. Check the structure of table and note your observation. ‘Add two new fields to the table billamt number(6,2) due_date date(8) Compute the bill amount for each customer as per the following rules min_amt Rs.50 First 100 units Rs 4.50 / unit >100 units Rs 5.50 / unit 4. Compute due date as billing date+15 days. 5. List all the bills generated 18. Create a student database and compute the result. ‘reate a table for a class of students with the following details POD a name type Student_id numb er[4] student_name | varchar2(25) subl_marks | number[2] sub marks numb er[2] sub& marks | number[3] sub4_marks | number[3] sub 5 marke numb er[2] subé6é marks | number[2] ‘Add records into the table for 10 students for name,student_id,student_name and marks in 6 subj command. Display the description of the fields in the table using dese command. Alter the table and Calculate total and perc_marks. Compute the result as “pass” or “fail” by checking if the student has scored more than 35 marks in each subject. List the contents of the table. Retrieve all the records of the table using insert Il PUC MANUAL 4 7. Retrieve only student_id and student_name of all the students 8. List the students who have result as “pass” 9. List the students who have the result as “fail” 10. Count the number of students who have passed 11. Count the number of students who have failed List the students who have percentage greater than 60 12. ho Generate the Bupioee details and compute the s ry based on the [iepartment. ‘reate the following table employee field name [data type [description emp-id number(4) _[ employee’s id number dept-id number(2) | department’s id number emp-name_| varchar2(25) | employee name emp_salary | number(5) __ | salary of the employee preate another table department with the following structure field name [data type _| description dept-id_[number(2)__| department’s id number ‘dept-name | varchar2(20) | department name supervisor | varchar2(20) | department head’s name ssume the department names as purchase(id-01),accounts(id-02),sales(id-03) nd apprentice(04). * Enter 10 rows of data for table employee and 4 rows of data for department table Write SQL statements for the following 1. Find the names of all employees who work for the accounts department 2. How many employees work for accounts department? 3. What is the minimum, maximum and average salary of employees working for accounts department? 4. List the employees working for a 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 column to the table employee, called_Bonus number and compute 5 % of the salary to the said field. 8. Delete all the rows for employees in the apprentice department I PUC MANUAL 5 20. Create database for the bank transaction. 1. Create a table for customer 2. Create a table bank 3. Insert data values into customers table 4 Insert data values for bank table 5. to display all records from customer table 6. to display all records from bank table. 7. To display all records from bank whose transaction date 8. To join two tables 9. Display count of all records and their corresponding transaction group by transaction type 10. Display all records from customer order by customer name in descending order. 11 Change the transaction amount. 12. Alter table customer to change the size of customer address. 13. Delete records from bank having an account number* 14. Create a table containing customer account number range. 15.Display records from customers whose name starts with ‘G’ 16. Display today’s date. 17. Display total transaction amount from bank table. 18. Create a view on customer showing customers no and customers phone number. 19. Display distinct customers number from bank. 20. Display account number from bank who have more than one transaction. 21. Display all records from customer whose phone number is NULL 22. Delete all records from customers table* 23. Drop table bank. 24. Drop table customer. SECTION-C 21. Write a HTML program to create a study time-table. 2. Create an HTML program with table and Form. I PUC MANUAL SECOND PUC PRACTICAL General instructions: ¢ Duration of practical examination: 2 hours. ¢ Maximum marks allotted: 30 marks. The practical examination question paper should consists of two questions for writing (One program from C++(C++ and data structure) and One problem from either SQL or HTML ) EXAMINATION SUB - COMPUTER SCIENCE (41) Each question carries 6 marks of writing ie 2X6=12 Marks. Only one experiment to be executed. Execution process carries 6(six ) marks. Generating the correct output for the executed problem carries two marks. Scheme of valuation A. Weightage of marks Sl. . Particulars Marks No. I__|Performing the Experiments 20 II_|Viva -voce 04 III |Practical Record 06 TOTAL 30 I PUC MANUAL B. Distribution of marks I. Performing the Experiment a) PROGRAMS ON C++ and Data structure Total SI. No. Particulars Marks 7 [Including the necessary headers: 1 2? | Declaration of correct object 1 3 |Impul/mputs commands 1 4 | Logic 2 5 | Output/Outputs commands 1 Total 6 b) PROBLEMS on SQL SI. No. Particulars Marks 1 _ | Creating table including the necessary attributes in SQL:| 2 2 Inserting data for the table (data entry) 1 3 | Using the correct sql query T 4 _ | Generating the correct output 2 Total 6 ©) PROBLEMS on Advanced HTML SI. No. Particulars Marks 1 | Including the necessary basic tags of the HTML 1 2 Including the necessary basic tags of the Header & Title 1 3 | Including any advanced HTML tags like Forms/tables 2 4 _ | Generating the correct output 2 6 Il PUC MANUAL 8 II. Viva- voce 1. Four questions must be asked and each question carries 1 mark.(external examiner two questions and internal examiner two questions). 2. The questions in the viva- voce should be simple, direct and related to the experiment to be performed by the student. HII. Practical Record SI. No, Particulars Marks If the student has performed and recorded 27 programs or more 91% to 100% of the experiments prescribed for the practical examination or more. ) If the student has performed and recorded 24 programs and below 27 programs (81% to 90% of the experiments prescribed for the practical examination.) If the student has performed and recorded 21 programs and below 24 programs (71% to 80% of the experiments prescribed for the practical examination.) If the student has performed and recorded below 21 and above 11 experiments (41% to 70% of the experiments prescribed for the practical examination) If the student has performed and recorded below 10 or below 10 experiments (40% and below40% of the experiments prescribed for the practical examination) NOTE: Conduct 22 experiments (16 from C plus plus +4 from SQL +2 from HTML ) experiments have to be conducted in the Practical classes. epee ERR O I I PUC MANUAL ° Experiment No: 1 rite a program to find the frequency of presence an element in an array. #include #include #include class frequency { private: int n, m[100], ele, freq; public: void getdata(); void findfreq(); void display(); void frequency: :getdata() cout<<"Enter the size of the array: "; cin>>n; cout<<"Enter "<>m[i]; cout<<"Enter the search element: "; cin>>ele; void frequency: :findfreq() freq = for(int i=0; i 0) cout<<"Frequency of “< class insertion cout<: m(itl] = mlil; m[p] = ele; nt+; cout<>n; cout<<"Enter the elements: "; for(int i=0; i>m[i]; cout<<"Enter the element to be inserted: cin>>ele; cout<<"Enter the position ( @ to “<>p; + void insertion: :insert() { if(p > n) { Il PUC MANUAL 12 + void insertion: :display() { cout<<"The array after the insertion is "; for(int i=0; icn; i++) cout< #include #include class deletion { void void private: int m[100], n, ele, p; public: void getdata(); void remove(); void display(); deletion: :getdata() cout<<"How many elements? "; cin>>n; cout<<"Enter the elements: "; for(int i=0; i>m[i]; cout<<"Enter the position (0 to "<>p; deletion: : remove () if(p > n-1) { cout< #include #include class sorting { private: int m[100], n; public: void getdata(); void sort(); void display(); cout<<"How many elements? "; cin>>n; cout<<"Enter the elements: "; for(int i=0; i>m[i]; } void sorting: :display() { cout<<"The array after sorting is "; for(int i=0; i=1) { if(m[j] #include #include class binarysearch Experiment No: 5 program to search for a given element in an array using Binary private: int m[100], n, ele, loc; public: void getdata(); void search(); void display(); binarysearch: :getdata() cout<<"How many elements? cin>>n; cout<<"Enter the elements: "; for(int i=0; i>m[i]; cout<<"Enter the search element: " cin>>ele; binarysearch: :display() if(loc >= 0) cout<<"Position= "< #include #include class interest Experiment No: 6 private: double p, t, r, si; public: void getdata(); void compute(); void putdata(); interest: :getdata() cout<<"Enter principle amount, time and rate"<>p>>t>>r; interes putdata() cout<<"Principle: “<0, print the real roots 3. If the discriminant<0, print that the roots are imaginary and exit the program #include #include #include #include class quadratic { private: double a,b,c,rl,r2; public: void getdata(); void roots(); void putdata(); yi void quadratic: :getdata() { cout<<"Enter the co-efficients: "; cin>>a>>b>>c; + void quadratic: :roots() { b*b-4*a*c; cout<<"Roots are equal"<0) { Il PUC MANUAL 22 cout<<"Roots are positive and different: "<>an if (ans = { 1) cout<<"Enter the side: "; cin>>x; cout<<"Area of the square = "<>x>>y; cout<<"Area of the rectangle = “<>x>>y>>z; cout< #include class assign private: int n; public: assign(int nn) { n = nn; int cube(); + inline int assign::cube() { return(n*n*n) ; void main() int n; cout<<"Enter the number: "; cin>>n; assign N =n; /IN is the object cout<<"Cube of "< #include class copy { int var, sum, term; public: double calculate(); copy(int temp, int x) { var = temp; term = x; + yi double copy::calculate() { int sum pe for(int i=l; i<=var; i++) { sum = sum + p; p =p * term; } return sum; + void main() { int n, ty clrser(); cout<<"Enter the base and the power(x and n): "; cin>>t>>n; copy obj(n,t); copy cpy = obj; cout<<"Sum of the series is "< #include #include class student { private: int rollno; char name[20]; public: void read() { cout<<"Enter the name: "; cin.getline(name, 20); cout<<"Enter Roll No: "; cin>>rollno; } void display() { cout<<"Roll no: "<< rollno <>m1>>m2; total= ml + m2; + void displayl() { Il PUC MANUAL 29 coute<"Subjectl = " #include #include class student private: int regno; char name[20]; float fees; public: void get(); void display(); student: :get() cout<<"Enter student name: "; cin.getline(name, 20); cout<<"Enter student register number: cin>>regno; cout<<"Enter student fees: "; cin>>fees; student: :display() cout<<"Student register number: "<get(); sp->display(); getch(); return 0; + Enter name: Harshith H R Enter Reg. No.: 1234 Enter student fees: 5000.75 Reg. No: 1234 Name: Harshith H R Fees: 5000.75 Enter student name: Shashikala S Enter student register number: 12345 Enter student fees: 5250 Student register number: 12345 Student name: Shashikala S$ Student fees: 5250 RUN RUN RUN 1 PUC MANUAL { void Experiment No: 13 rite a program to perform push items into the stack. #include #include #include #define MAX 3 class Stack private: int A[MAX], top; public: Stack() { top = -1; void Push(int item); void print(); Stack::Push(int item) if(top == MAX-1) { cout<>choice; switch(choice) { case 1: { cout<<"Enter the item: "; cin>>itm; S.Push(itm) ; break; } case 2: { S.print(); break; + case 3: { cout<<"Thank you.. Visit again"; exit(0); } default: cout<<"Invalid choice"< #include #include #define MAX 3 class Stack private: int A[MAX], top; public: Stack() { top = -1; void Push(int item); void print(); void Pop(); + void Stack:: Push(int item) if(top == MAX-1) { cout<>choice; switch(choice) case 1:{ cout<<"Enter the item: "; cin>>itm; S.Push(itm) ; break; case 2:{ S.Pop(); break; case 3:{ S.print(); break; case 4:{ cout<<"Thank You... Visit again." exit(1); I PUC MANUAL 37 derautt: cout<<"\tInvalid choice... < prbnt stack ER tery yeur choices, 1 sorry, Stack is full | : Fine stack Eater ur choice, fou sbcedsSiutty popped Pent stack Ater your choice: 3 Lage conan 10 20 a Pas 0) Prine stack nteryour_ choice. 50 ge soecdssiuty popped oT ts 2 3 a E maw x1 nter your choice: 3 I PUC MANUAL 38 Stack contains 10 . Ex Enter ur choice; To Pe 5 secdsSfutly popped ” pus + Pol : rent stack . x1" iter your choice: 2 Sorry, Stack is ‘empty ———_— oo oo oo #include #include #define QUEUE _SIZE 3 class Queue private: int q[QUEUE SIZE]; int front, rear; int count; public: Queue(); void enqueue(int x); void dequeue(); void getSize(); hi Queue: :Queue() { front = -1; rear = -1; count = 0; } void Queue::enqueue(int x) { if(rear == QUEUE_SIZE -1) { cout<<"\tSorry... Queue is full."< 0) cout<<"\tQueue contains "; for(int i=front; i<=rear; i++) cout<>choice; switch(choice) case 1:{ cout<<"Enter the item: "; cin>>item; Il PUC MANUAL ay T-enqueve(itmy; break; } case 2:{ Q.dequeue(); break; } case 3:{ Q.getSize(); break; + case 4:{ cout<<"Thank You... Visit again" exit(1); + default: cout<<"\tInvalid choice..."< #include class LinkList private: struct Node int data; Node* link; }*START; public: LinkList(); void Print(); //Prints the contents void Append(int num); //Adds a new node at the end void Count(); //Counts number of nodes ti LinkList::LinkList() START = NULL; // Prints the contents of linked list void LinkList::Print() if (START NULL) { cout<<"Linked list is empty"<data<<" tmp = tmp->link ; } 7/ Adds a new node at the end of the linked list void LinkList::Append(int num) Node *newNode; 43 Il PUC MANUAL aad newNode = new Node; newNode->data = num; newNode->link = NULL; if(START == NULL) { //create first node START = newNode; cout<Link != NULL) tmp = tmp->Link; //add node to the end tmp->link = newNode; cout<lLink) cH; cout<Print(); obj->Append( 100) ; obj->Print(); obj->Count(); obj ->Append (208) ; obj->Print(); I PUC MANUAL 45 obj->Count(); obj ->Append (309) ; obj->Print(); obj ->Count(); Linked 100 is Linked No. of 200 is Linked No. of 300 is Linked No. of list is empty inserted as the first node list contains 100 nodes in the linked list= 1 inserted list contains 100 200 nodes in the linked list= 2 inserted list contains 100 200 300 nodes in the linked lis 3 Change the actual arguments in the program and run again Il PUC MANUAL 46 SOL As: jent Experiment No 17 (Generate the Electricity Bill for one consumer {Create a table for house hold Electricity bill with the following fields Field name type RR_number Varchar2(10) consumer_name | varchar2(25) date_billing Date units number(4) Insert 10 records into the table Check the structure of table and note your observation: . Add two new fields to the table bill_amt number(6,2) + due_date date(8) 4. Compute the bill amount for each customer as per the following rules min_amt Rs.50 First 100 units Rs 4.50 / unit >100 units Rs 5.50 / unit 5. Compute due date as billing date+15 days. . List all the bills generated Rote: Verify the date format using sysdate command olution: Command to create a table Sql> create table elect_bill(RR_number varchar2(10),consumer_name archar2(25),date_billing date, units number(4)); ll. Command to add records into the table insert into elect_bill values('A1001','Manjunath’,’2/2/2014',34); |Add the data to the table as given below N ‘A1001 | Manjunath [12/2/2014 [34 ‘1098 | Reeta 14/2/2014 [128 | 1190 | Nithin 92/2014 [234 1234 | Vikas 14/2/2014 | 256 82345 | Parinitha | 13/2/2014 | 277 ‘1987 | Tarun vohra_| 23/2/2014 | 289 ‘82456 | Solanki 12/2/2014 | 178 (3459 | Patil SS 15/2/2014 | 176 83765 | Yashaswini_| 13/2/2014 | 160 ‘4790 | Lakshman Js [ 16/2/2014 | 299 Il PUC MANUAL a7 Command to check the structure of a table dese elect_bill; ote: sql> commit; (Used to store all the permanently in the elect_bill table) 8. Command to add two new fields to the table Alter table elect_bill add{amount number(6,2), due_date date); /. Command to compute bill amount Update elect_bill set amount=50 ; Update elect_bill set amount=amount+ 100*4.50+(units-100)*5.50 where units>100; Update elect_bill set amount=amount+units*4.50 where units <=100; Update elect_bill set due_date=date_billing+15 ; 5. Command to view the bill statement Select * from elect_bill; Il PUC MANUAL 48 Experiment No 18 (Create a student database and compute the result. reate a table for a class of students with the following details name, type Student id numb er[4] student_name| varchar2[25] subl_marks | numb er{2] sub 2 marics numb er[2] subS marks | numb er{2] sub4_marks | numb er{2] sub 5S marics numb er[2] sub6_marks | numb er{2] 1. Add records into the table for 10 students for name,student_id,student_name and marks in 6 subjects using insert command. 2. Display the description of the fields in the table using dese command. 3. Alter the table and Calculate total and perc_marks. 4. Compute the result as “pass” 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 student_id and student_name of all the students 8. List the students who have result as “pass” 9. List the students who have the 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 student_id. Solution: 1. Command to create a table Sql> create table student_master (student_id number(4),student_name archar2(25), subl_marks number(2),sub2_marks number(2),sub3_marks yumber(2),sub4_marks number(2),subS_marks number(2),sub6_marks umber(2)); 2. Command to add records into the table dd records using insert command as follows insert into student_master values(1124,’Anuthara’,67,82,86,90,56,78); insert into student_master values{1127,’Bhargavi’,56,69,78,34,52,59); insert into student_master values(1113,”Manjunath’,45,47,51,40,50,51); insert into student_master values(1121,’Bhavani’,28,36,45,34,37,39); te the rest of the rows similarly so that table contains the following data Il PUC MANUAL 49 1124 |Anuthara 67 | 82 186 [90 156 178 1127 |Bhargavi 56 [69 [78 [34 [52/59 1115 | Manjunanth [45 [47 [51 [40 [50] 51 1121 |Bhavani 28 | 36 145 | 34 | 37 | 39 1122 | Preetham 34 | 56 | 68 | 79 | so | 96 1125 | Sanjay 78189 |] 90 196 195 |92 1129 [Kishan 68 [Fr [84 [69 [7o [79 1123 | Savyasachi [78/89 [86 [88 [90/85 1120 |Varun 56 [30 ]35 | 47 [55 | 54 1119 [Joseph 66 [69 ] 60] 70/81 | 59 2. Command to view the structure of the table Desc student_master; 8. Command to alter the table Add the following fields to the table using alter command total number(3) perc_marks | number(2) result varchar2(10) 4. Command to calculate total PDATE student_master SET tal-sub1_marks+tsub2_marks+sub3_marks+sub4_marks+subS_marks+sub6_mark: (where student_id>0); ‘optional {Command to calculate percentage PDATE student_master SET perc-total/6.0 WHERE student_id>0; }. Command to calculate result as pass UPDATE student_master SET result=’pass’ WHERE sub1_marks>=3 1ub2_marks>=35 and sub3_marks>=35 and sub_marks>=35 and uubS_marks>=35 and sub6_marks> ‘ommand to calculate result as fail UPDATE student_master SET result=’fail’ WHERE sub 1_marks<35 or sub2_marks<35 or sub3_marks<35 or sub_marks<35 or sub5_marks<35 or uub6_marks<35; . command to view the contents of the table ct * from student_master; 6. Command to retrieve all the records of the table elect * from student_master; and Il PUC MANUAL 50 4 Command to retrieve only student_id and student_name of all the btudents elect student_id,student_name from student_master; elect * from student_master where result=’pass’; . Command to list the students who have result as “fail” elect * from student_master where result="fail’; l10. Count the number of students who have passed elect count(*) from student_master where result="pass’; 11. Command to count the number of students who have failed elect count(*) from student_master where result=’fail’; 112. Count the number of students who have percentage more than 60 kelect * from student_master where perc>=60; 13. Command to sort the student list according to student_id ELECT * FROM student_master ORDER BY student_id; Fe Command to list the students who have result as “pass” Il PUC MANUAL St Experiment No: 19 (Generate the Employee details and compute the salary based on the lepartment. Create the following table employee field name [data type [description emp-id number(4) | employee’s id number dept-id number(2) __| department's id number emp-name_| varchar2(25) | employee name emp_salary | number(s) __ | salary of the employee reate another table department with the following structure field name [data type _| description deptid | mumber(2) | department's id number dept-name | varchar2(20) | department name supervisor | varchar2(20) | department head’s name Assume the department names as purchase(id-01),accounts(id-02),sales(id-03) nd apprentice(04). * Enter 10 rows of data for table employee and 4 rows of data for department table Write SQL statements for the following Find the names of all employees who work for the accounts department 2. How many employees work for accounts department? 3. What is the minimum, maximum and average salary of employees working for accounts department? 4. List the employees working for a particular supervisor. 5. Retrieve the department names for each department where only one employee works Increase the salary of all employees in the sales department by 15% Add a new column to the table employee, called Bonus number(5) and compute 5 % of the salary to the said field. 8. Delete all the rows for employees in the apprentice department no Il PUC MANUAL 52 Solution : Create a table Employee 1009 [01] Arun guptha [25000 1045 | 02 | Priya Rao 27500 1034 | 02 | Vanshidhar 23700 1067 | 03 | Anup kaul 36000 1058 | 04 | Hari Prasad 29000 1029 | 03 | Anil Goel 19350 1044 | 02 | Harsha shenoy | 52000 1030 | 03 | Surya 14500 1022 | 04 | Keerthi 37900 \create a table department 01 [Purchase _| Ameen 02 [Accounts _| Krishna reddy 03 | Sales ‘Tanveer FGC 04 | Apprentice | Ashish mehra 1. Command to find the names of all employees who work for the accounts department Select * from employee where dept-id=(select dept_id from department where dept-name=’Accounts); 2. Command to find the number of employees who work for the accounts department Select count(*) from employee where dept-id=(select dept-id from department where dept-name=Accounts’); 3. Command to find the minimum, maximum and average salary of employees who work for the accounts department Select min(emp_salary) from employee where dept-id=(select dept-id from department where dept-name=’Accounts); Select max(emp_salary) from employee where dept-id=(select dept-id from department where dept-name=’Accounts’); Select average(emp_salary) from employee where dept-id=(sclect dept- id from department where dept-name=’Accounts)); note:All of the above three commands can be combined into a single query 4. Command to list the employees working for a particular supervisor select * from employee where dept-id=(select dept-id from department where supervisor~Tanveer)}; Il PUC MANUAL 83 Command to retrieve the department names for each department where only one employee works select dept-name from department where dept-id_in(select dept-id from employee group by dept-id having count(*)=1); Command to increase the salary of all employees in the sales department by 15% update employee set emp_salary~ emp_salary+emp_salary*0.15 where dept-id=(select dept-id from department where dept-name='sales’)) ; Command to add a new column to the table employee, called —Bonus number(5) and compute 5 % of the salary to the said field. alter table employee add bonus number(5); update employee set bonus=emp_salary*0.05; Command to delete all the rows for employees in the apprentice department delete from employee where dept-id=(select dept-id from department where dept-name-‘apprentice)}; IL PUC MANUAL 54 — Experiment No 20 Create database for the bank transaction, _ SQL> create table customer(cno number(4) primary key, cname char(25), caddress varchar2(50), cphone char(12)); Table created. SQL> dese table customer Usage: DESCRIBE [user.]object[@db_link] SQL> desc customer Name Null? Type cNO NOT NULL NUMBER(4) CNAME CHAR(25) CADDRESS VARCHAR2(50) CPHONE CHAR(12) SQL> create table bank(accno number(8) not NULL, tramount number(8,2) check(tramount>0), trdate date , trtype char, cno number(4)); Table created. SQL> insert into customer values(100,’Anush’,'Churchstreet, Bangalore’,'25595235); SQL> insert into customer values(101,’Ganesh’,’M G Road, Bangalore’,’2559553'); SQL> insert into customer values(102,’Nagamani’,Jayalaksmi, Mysore’,’23343434'); SQL> insert into bank values(1300,23961.75,’01-mar-2014',’D’,100); SQL> insert into bank values(13101, 70000,'26-MAR-2014','C’, 100); SQL> insert into bank values(13102,2400,’21-Jan-2014',’C’,102); SQL> insert into bank values(13103,59681.25,'14-FEB-2014',’D’,103); SQL> select * from customer; CNO CNAME CADDRESS CPHONE 100 Anush Churchstreet, Bangalore 25595235 101 Ganesh MG Road, Bangalore 2559553 102 Nagamani Jayalaksmi, Mysore 23343434 Il PUC MANUAL 88 SQL> select * from bank; ACCNO TRAMOUNTTRDATE T CNO 1300 23961.7501-MAR-14D 100 13101 70000 26-MAR-14C — 100 13102 2400 21-JAN-14C 102 13103 59681.25 14-FEB-14D 103 Lb sleet * fran custoner ~ rest oF Line ignored. known connand beginning “slect + Fr... bd 1D select * Fron custoner ENO CNAME [eRDDRESS PHONE 190 anus churcnstreet ,sangaiore 25595235 481 Ganesh WG Road, Bangalore 2550569 4162 Haganani dayalaksnitysore 2agnaaay Lb select * Fron bank; cena TRAMQUNT TRDATE = en 29961.75 O1-HAR-14 D 100 79008 26-MAR-1h C 100 13102 ac 192 43183 59681.25 14-FEB-14 D 168 SQL> select * From bank where trdate ="01-mar-2014" and trdate>* 61-nar-2614° 5 no rows selected SQL> select * from bank where trdate>="01-mar=2014" ; T 0 4300 29961.75 61-HAR-1h D 400 4311 7MAAN 76-MAR-1h 49a SQL> select * From bank where trdate ='O1-nar-2014' and trdate>' O1-mar-2014" ; no rows selected SQL> select * From bank where trdate>="61-nar-2014"; ACCNO TRAMOUNT TROATE = T ono -MAR-14 D 1 13164 70000 26-HAR-14 C 1 SQL> | Il PUC MANUAL 56 SQL> select accno,custoner.cno,cnane fron customer bank where custoner’.cno-bank.cno; ACCHO CHO CANE 1300 168 Anush sa10t 109 nus 13102 102 Haganani squ | SQL> select trtype, count(#) From bank group by trtype; T COUNT(#) c 2 D 2 SQL> select * fron custoner order by cnane dese; CHO CANE ‘CADDRESS PHONE 402 Haganani Jayalaksni tysore 29909494 401 Canesh MG Road, Bangalore 2559553 400 fnush Ghurchstreet Bangalore 25595295 SQL> update bank set tranount = 70000 where accno=13101 1 row updated. SQL> alter table custoner modify caddress char(50); Table altered. SQL> delete fron bank where accno=1300; 1 row deleted. SQL> create table tenpcust as (select # from custoner vhere cno detween 100 and 102); Table created. sal | Il PUC MANUAL ST SQL> create table tenpcust as (select * Fron custoner where cno between 100 and 102); Table created. SQL> select * Fron custoner were cnane Like “g's no rows selected SQL> select * Fron custoner where cnane Like ‘6% (CHO CHAE cADDRESS PHONE 101 Ganesh "1G Road, Bangalore 2559553 SQL? select sysdate fron dual; SYSDATE 6-aPR-1 SQL> select sun(tranount) fron bank; SUM(TRAHOUNT) 7 y92094.25 SQL? create view viewcust as select cno,cphone fron custoner; View created. say SQL> select * from custoner where cname Like "C2"; WO CNANE ‘cADDRESS. PHONE 161 Ganesh 1G Road, Bangalore 2550553, SQL> select sysdate fron dual; SYSDATE 5-APR-14 SQL> select sun(tranount) fron bank; SUNCTRAMOUNT) 182081.25 SQL> create view viewcust as select cno,cphone fron custoner; View created. SQL> select distinct(cno) Fron bank; I PUC MANUAL 58 SQL> create view viewcust as select cno,cphone Fron custoner; View created. SQL> select distinct(eno) Fron bank; SQL> select accno, count(+) From bank group by accno having count(*)>4; no rows selected SQL> select # Fron custoner where ephone=* MILL! no vous selected ‘SQL> delete From customer; 43 rows deleted. SQL> drop table bank; Table dropped. I PUC MANUAL 59 Experiment No 21 Write a HTML program to create a study time-table. MY STUDY TIME-TABLE FOR THE WEEK

Beautiful Sunrise








I PUC MANUAL 63














I PUC MANUAL oF
Month No of Classes held No of class attended
JUNE 08
JULY 16
AUGUST 16
SEPTEMBER 16
OCTOBER 08
NOVEMBER 16
DECEMBER 16
JANUARY 16
FEBRUARY 08
Total NO of DAYS 120
PERCENTAGE


‘top"">* ‘Student_Name">Student Name *“ “ etre“ “ " top" 'Father_name">Father Name * “ “ ““ “etr>* “ “““ ‘email">Email Address *“ “ ““"" “ Peer RED CROSS Jean Henry Dunant of Switzerland established the international humanitarian service organisation “Red Cross” in Geneva. His birthday which falls on | May 8 is celebrated as “World Red Cross Day” | every Year. ol C { PRINCIPLES OF RED CROSS: a ! Jean Henry Dunant (1) Humanity (2) Impartiality (3) Neutrality (1828-1910) (4) Independence (5) Voluntary Service (6) Unity (1) Universality. Red Cross Society was established in India in the year 1920 under the Indian Red Cross Society Act (Parliament Act of XV 1920) and 1921 in Karnataka. ACTIVITIES OF RED CROSS: ‘The main activities of this organisation are treating the wounded soldiers, helping the needy, establishing blood banks, conducting blood donation camps, health programmes and blood grouping, helping the victims of floods, drought, earthquake, providing them drinking water, food, medicine, clothes, helping the differently abled people and conducting other useful activities to help the public. The Junior/ Youth Red Cross units in schools/colleges can also participate in these programmes. Red Cross examination is being conducted for high school students every year. AL the national level, the President of India is the President of Indian Red Cross Society and the Governor for State Unit. Deputy Commissioner for district and Tahasildar for taluk unit. Indian citizens can become the members and volunteers of Red Cross by paying prescribed fee. Chairman, Vice-Chairman, Hon. Treasurer (elected) and General Secre- tary administer the branches of this organisation. RED CROSS SYMBOL : As adopted in Geneva Convention of 1864, Red Cross in white background is used in India. This symbol should not be used by others, if used, itis a punishable. NOBEL PRIZES: Red Cross is the only organization in the world which has won Nobel Prize four times (including the founder of Red Cross). CONTACT THE FOLLOWING ADDRESS TO AVAIL SERVICES: Indian Red Cross Society, Karnataka State Branch, #26, Ist Floor, Red Cross Bhavan, Race Course Road, Bengaluru — 560001. Notes

You might also like

" Student_name" maxlengt
" “ Il PUC MANUAL 65 7
" “ submit’ value="Submit"> ‘http://www. freecontactform.com/html_form.php"> HTML Form )*