Class Xii Lab Manual (21 To 22) Full Book
Class Xii Lab Manual (21 To 22) Full Book
Table: Employee
Eid Name Depid Qualification Gender
1 Deepali Gupta 101 MCA F
2 Rajat Tyagi 101 BCA M
3 Hari Mohan 102 B.A. M
4 Harry 102 M.A. M
5 Sumit Mittal 103 B.Tech. M
6 Jyoti 101 M.Tech. F
Table: Salary
Eid Basic D.A HRA Bonus
1 6000 2000 2300 200
2 2000 300 300 30
3 1000 300 300 40
4 1500 390 490 30
5 8000 900 900 80
6 10000 300 490 89
Write the SQL commands for the following using above tables:
(i) To display the details of all the employees.
(ii) To list the names of those employees only whose name starts with ‘H’
(iii) To add a new column in salary table. The column name is Total_Sal.
(iv) To store the corresponding values in the Total_Sal column.
Give the output for the following SQL commands:
(v) Select max (Basic) from salary where Bonus > 40;
(vi) Select count (*) from Employee group by Gender;
(vii) Select Distinct Depid from Employee;
Table: FABRIC
FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 NYLON
Write the SQL commands for the following using above tables:
(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
(ii) To display the details of all the GARMENT, which have READYTYPE in between 08-DEC-07
and 16-JUN-08 (inclusive of both the dates)
(iii) To display the average PRICE of all GARMENT, which are made up of FABRIC with FCODE as FO3.
(iv) To display FABRIC wise highest and lowest price of GARMENT from GARMENT table.(display FCODE
of each GARMENT along with highest and lowest price)
Table: CUSTOMER
Write the SQL commands for the following using above tables:
(i) To display the details of those Customers whose City is Delhi
(ii) To display the details of Item whose Price is in the range of 35000 to 55000
(Both values included)
(iii) To display the CustomerName, City from table Customer, and ItemName and Price
from table Item, with their corresponding matching Itemid
(iv) To increase the Price of all Items by 1000 in the table item
Give the output for the following SQL commands:
(v) SELECT DISTINCT City FROM Customer ;
(vi) SELECT ItemName, Max(Price), Count(*) FROM Item GROUP BY ItemName;
(vii) SELECT CustomerName, Manufacturer FROM Item, Customer
WHERE Item.Itemid = Customer.Itemid ;
(viii) SELECT ItemNmae, Price * 10 FROM Item Where Manufacturer = ‘Intel’;
TABLE : RECIPIENT
Write the SQL commands for the following using above tables:
(i) To display the names of all Senders from Mumbai
(ii) To display the RID, SName, SAddress, RName, RAddress for every Recipient
(iii) To display Recipient details in ascending order of Rec name
(iv) To display number of recipients from each city
Give the output for the following SQL commands:
(v) SELECT DISTINCT SCity from sender;
(vi) SELECT A. SName, B.RName FROM Sender A, Recipient B
WHERE A. SID = B.SID AND B.RCity = ‘Mumbai’;
(vii) SELECT Rec Name, Rec Address FROM Recipient
WHERE Rec City NOT IN (‘Mumbai’, ‘Kolkata’);
(viii) SELECT Rec ID , Rec Name FROM Recipient
WHERE Sender ID = ‘MU02’ OR Sender ID = ‘ND50’;
MR.G.ANBARASU PRACTICAL LAB MANUAL
PAAVAI VIDHYASHRAM, NAMAKKAL 16
INFORMATION TECHNOLOGY (802) CLASS XII
JAVA PROGRAMS
6.IF ELSE IF STATEMENT
AIM:
To create if else something program using java
ALGORITHM:
1. Start the program
2. Get the input from the user
3. Check the inputs based on conditions
4. If the conditions is true, block will execute
5. If the condition is false, else if block will execute
6. Stop the program
FLOWCHART:
PROGRAM:
import java.util.Scanner;
public class IfElse
{
public static void main(String[] args)
{
int marks;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the Mark");
mark=sc.nextint();
if(marks<50)
{
System.out.println("fail");
}
else if(marks>=50 && marks<60)
{
System.out.println("D grade");
}
else if(marks>=60 && marks<70)
{
System.out.println("C grade");
}
else if(marks>=70 && marks<80)
{
System.out.println("B grade");
}
else if(marks>=80 && marks<90)
{
System.out.println("A grade");
}
else if(marks>=90 && marks<100)
{
System.out.println("A+ grade");
}
else
{
System.out.println("Invalid!");
}
}
}
OUTPUT:
Enter the mark 90
A+ grade
Enter the mark 55
D grade
Enter the mark 65
C grade
RESULT:
Thus the above Java Program was Executed Successfully.
PROGRAM:
import java.util.Scanner;
public class switchcase
{
public static void main(String[] args)
{
char ch;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the Alphabet Letter ");
ch= sc.next().charAt(0);
switch(ch)
{
case 'a':
System.out.println("Vowel");
break;
case 'e':
System.out.println("Vowel");
break;
case 'i':
System.out.println("Vowel");
break;
case 'o':
System.out.println("Vowel");
break;
case 'u':
System.out.println("Vowel");
break;
case 'A':
System.out.println("Vowel");
break;
case 'E':
System.out.println("Vowel");
break;
case 'I':
System.out.println("Vowel");
break;
case 'O':
System.out.println("Vowel");
break;
case 'U':
System.out.println("Vowel");
break;
default:
System.out.println("Consonant");
}
}
}
OUTPUT:
Enter the alphabet
a
It is a vowel
Enter the alphabet letter
E
Enter the alphabet letter
e
It is a vowel
Enter the alphabet letter
D
It is a consonant
RESULT:
Thus the above Java Program was Executed Successfully.
PROGRAM:
import java.util.Scanner;
public class swaping
{
private static Scanner sc;
public static void main(String[] args)
{
int a, b;
sc = new Scanner(System.in);
System.out.print(" Please Enter the First value : ");
a = sc.nextInt();
System.out.print(" Please Enter the Second value : ");
b = sc.nextInt();
System.out.println("\n Before Swapping: a = " + a + " and b = " + b);
swapping(a, b);
}
public static void swapping(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
System.out.println("\n After Swapping: a = " + a + " and b = " + b);
}
}
OUTPUT:
Please Enter the First value: 5
Please Enter the Second value: 6
RESULT:
Thus the above Java Program was Executed Successfully.
AIM
To create a java program by using different string manipulation operation
ALGORITHM
1. Start the program
2. Assign a static input for the string variable
3. Display the character at position 6, using char chart (int index)
4. Concatenate the specified string at the end of giving string using stringconcat
(string str)
5. Returns “true” if the given string contains the specified sub string using Boolean
contains (string s) , else return “false”
6. Compare the given string with the specified string ignoring case if equal returns “true”
else return “false”
7. Stop the program
PROGRAM:
public class stringmanipulation
{
public static void main(String[] args)
{
String a="HELLO WORLD";
System.out.println("GIVEN STRING="+a);
System.out.println("chatAt position 6:"+a.charAt(6));
System.out.println("concat 'TODAY'="+a.concat(" TODAY"));
System.out.println("contains 'HELL'="+a.contains("HELL"));
System.out.println("endsWith 'old'="+a.endsWith("old"));
OUTPUT:
GIVEN STRING =HELLO WORLD
chatAt position 6 =W
concat 'TODAY' =HELLO WORLD TODAY
contains 'HELL' =true
endsWith 'old' =false
equals 'goodbye world' =false
equalsIgnorecase 'hello world'! =true
indexOf W =6
indexOf 'RLD' =8
isEmpty =false
length =11
replace L with * =HE**O WOR*D
replace 'HELLO' with 'YELLOW' =YELLOW WORLD
LowerCase =hello world
UpperCase =HELLO WORLD
RESULT:
Thus the above Java Program was Executed Successfully.
ANSWER KEY
create table salary(Eid integer, Basic integer, D.A integer, HRA integer, Bonus integer);
Result:
Thus the above SQL queries was executed successfully.
Result:
Thus the above SQL queries was executed successfully.
ii. select * from garment where readydate between '08-DEC-07' and '16-JUN-08';
GCODE Description price FCODE READYDATE
10001 formal shirt 1250 F01 12-JAN-08
10007 formal pant 1350 F01 09-MAR-08
10012 Informal shirt 1550 F02 06-JUN-08
10019 Evening gown 850 F03 06-JUN-08
iii. select avg(price) from garment where fcode ='f03';
AVG(PRICE)
875.00
Result:
Thus the above SQL queries was executed successfully.
Result:
Thus the above SQL queries was executed successfully.
Result:
Thus the above SQL queries was executed successfully.