0% found this document useful (0 votes)
107 views34 pages

Record Notebook Manual

The document contains code snippets for various Java programs including: 1) A program to perform mathematical operations on two input numbers 2) A program to calculate simple interest and amount given principal, rate, and time 3) A program to find the greatest of three input numbers The document provides code solutions to various programming problems in Java.

Uploaded by

Roopa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views34 pages

Record Notebook Manual

The document contains code snippets for various Java programs including: 1) A program to perform mathematical operations on two input numbers 2) A program to calculate simple interest and amount given principal, rate, and time 3) A program to find the greatest of three input numbers The document provides code solutions to various programming problems in Java.

Uploaded by

Roopa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Grade 12 – IP

PRACTICAL NOTES
INDEX

SNO INDEX DATE


JAVA
1 Develop an application to perform mathematical operations on two
numbers
2 . Input the Principal, Rate and Time and calculate the Simple
Interest and Amount
3 Program to find the greater of three numbers
4 Program to input a number and display the even and odd numbers
5 Enter the Sales and calculate the incentive of a salesman depending
on the choice
6 Calculate the charges to customers for different product
7 Program to input a number & find its factorial
8 Program to print different triangles
9 Calculate the price for various product.
10 Design a GUI application to displays colours on appropriate
controls
11 Displaying string functions
12 Coding to concatenate two string along with the Input & Message
Dialog Box
13 Program to perform String manipulations
14 Program to Display,Update,delete,add and search the record from
MySQL database to java Swing
15 Program to fetch first,last,previous, next record from MySQL
database
MYSQL
16 SQL Queries
HTML
17 HTML - What is Social Networking
18 HTML – Student Registration Form
Networking and Open Source Concepts
19 Network Configuration and OSS
Q1. Develop an application to perform mathematical operations on two numbers

private void btnAOActionPerformed(java.awt.event.ActionEvent evt) {

int n1, n2, aoPlus, aoMult, aoRem, Diff;

float aoDiv;

n1 = Integer.parseInt(txtNum1.getText());

n2 = Integer.parseInt(txtNum2.getText());

aoPlus = n1 + n1; // integer addition

Diff = n1 - n2; // integer subtraction

aoMult = n1 * n2; // integer multiplication

aoDiv = n1 / n2; // integer division

aoRem = n1 % n2;

txtPlus.setText(“”+aoPlus );

txtMinus.setText(“”+ Diff);

txtMult.setText(“”+ aoMult);

txtDiv.setText(“”+aoDiv);

txtMod.setText(“”+aoRem);

}
private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

Q2. Input the Principal, Rate and Time and calculate the Simple Interest and Amount

private void calculateinterestActionPerformed(java.awt.event.ActionEvent evt) {

int prin = Integer.parseInt (t1.getText());

int rate = Integer.parseInt (t2.getText());

int time = Integer.parseInt (t3.getText());

double interest = ( prin * rate * time) / 100;

t4.setText ("" + interest);

private void calculateamountActionPerformed(java.awt.event.ActionEvent evt) {

int prin = Integer.parseInt (t1.getText());

int rate = Integer.parseInt (t2.getText());

int time = Integer.parseInt (t3.getText());

double interest = ( prin * rate * time) / 100;

double amount = prin + interest;

t5.setText ("" + amount);


}

private void exitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

// TODO add your handling code here:

private void clearActionPerformed(java.awt.event.ActionEvent evt) {

t1.setText("");

t2.setText("");

t3.setText("");

t4.setText("");

t5.setText(""); }

Q3. Program to find the greater of three numbers

private void grButtonActionPerformed(java.awt.event.ActionEvent evt) {

int N1, N2, N3; // Variables to hold three input values.

int max; // Variable to hold maximum value.

N1 = Integer.parseInt(txtN1.getText());

N2 = Integer.parseInt(txtN2.getText());

N3 = Integer.parseInt(txtN3.getText());

if ((N1 > =N2) && (N1 > N3))


max = N1;

else if ((N2 > =N1) && (N2 > N3))

max = N2;

else if ((N3 > N1) && (N3 > N2))

max = N3;

jLabel4.setText("The greater number is : " + max);

private void exButtonActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

Q4. Application to input a number and display the even and odd numbers

private void jButton1ActionPerformed(java.awt.event.ActionEvent


evt) {
int LastNumber=Integer.parseInt(jTextField1.getText());
if (jRadioButton1.isSelected()) //Even Numbers required
{
for (int I=2;I<=LastNumber;I+=2)
jTextArea1.setText(jTextArea1.getText()+ " " +Integer.toString(I));
}
else if (jRadioButton2.isSelected())//Odd Numbers required
{
for (int I=1;I<=LastNumber;I+=2)
jTextArea1.setText(jTextArea1.getText()+ " " +Integer.toString(I));
}
else
JOptionPane.showMessageDialog(this,"Click to select [Even] or [Odd]
Option");
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
// Code for Reset button :
jTextField1.setText("");
jRadioButton1.setSelected(false);
jRadioButton2.setSelected(false);
jTextArea1.setText("");
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt)
{
System.exit(0);
}

Q5. Enter the Sales and calculate the incentive of a salesman depending on the choice of any one option of
achievement : Maximum Sales – 10% of sales, Customer feedback – 8% of sales, Maximum Customers- 5%
of Sales. (Implementing Button Group)

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:

System.exit(0);

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

// Declare & initialize variables for storing sales

int sales = 0;

sales = Integer.parseInt(t1.getText());

double incentive = 0.0;

if(c1.isSelected()){

incentive = 0.1; //10%

if(c2.isSelected()){

incentive = 0.08; //8%

if(c3.isSelected()){

incentive = 0.05; //5%

double t = (sales * incentive);

l1.setText("" + t);

Q6. ABN Shipment Corporation imposes charges to customers for different product. The shipment company
costs for an order in 2 forms : Wholesaler &Retailer. The cost is calculated as below :

No Units Price for wholesaler (per unit) Price for retailer (per unit)

1 – 15 Rs 50/- Rs 60

16 - 20 Rs 45/ Rs 55/

21 - 30 Rs 40/ Rs 50/

31 - 50 Rs 35/ Rs 45/
> 50 Rs 30/ Rs 40/

Special customers are further given a discount of Rs 10%

private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {

txtTCost.enable(false);

optWhole.setSelected(true);

private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void cmdCalcActionPerformed(java.awt.event.ActionEvent evt) {

int ordUnit; // Order unit

float TCost=0; // Total cost

float Discount = 0 ; // Discount price

ordUnit=Integer.parseInt(txtUnit.getText());
if (optWhole.isSelected())

{ if (ordUnit >= 1 && ordUnit <= 15)

TCost = ordUnit * 50;

else if (ordUnit >= 16 && ordUnit <= 20)

TCost = ordUnit * 45;

else if (ordUnit >= 21 && ordUnit <= 30)

TCost = ordUnit * 40;

else if (ordUnit >= 31 && ordUnit <= 50)

TCost = ordUnit * 35;

else if (ordUnit > 50)

TCost = ordUnit * 30;

else if (optRetail.isSelected())

if (ordUnit >= 1 && ordUnit <= 15)

TCost = ordUnit * 60;

else if (ordUnit >= 16 && ordUnit <= 20)

TCost = ordUnit * 55;

else if (ordUnit >= 21 && ordUnit <= 30)

TCost = ordUnit * 50;

else if (ordUnit >= 31 && ordUnit <= 50)

TCost = ordUnit * 45;

else if (ordUnit > 50)

TCost = ordUnit * 40;

}
if (chkSpecial.isSelected())

Discount = TCost * (float)0.1;

txtDisc.setText(Float.toString(Discount)); // (i) Displaying discount

TCost=TCost – Discount ;

txtTCost.setText(Float.toString(TCost)); // (ii) Displaying Total Cost

Q7. Program to input a number & find its factorial (while loop & input dialog box)

import javax.swing. JOptionPane;

private void btnFactActionPerformed(java.awt.event.ActionEvent evt) {

int num, i = 1;

float fact = 1;

String str = JOptionPane.showInputDialog("Enter positive number to find factorial");


txtNum.setText(str);

num = Integer.parseInt(str);

if (num = = 1)

JOptionPane.showMessageDialog(this, "Factorial is 1");

while( i<=num)

fact = fact * num;

i = i + 1;

txtFact.setText(Float.toString(fact));

Q 9. Program to print different triangles

private void clearActionPerformed(java.awt.event.ActionEvent evt) {

t1.setText ("");

t2.setText ("");

r1.setSelected(false);

r2.setSelected(false);

}
private void r1ActionPerformed(java.awt.event.ActionEvent evt) {

int a = Integer.parseInt (t1.getText());

for (int i = a; i>=1; i--)

t2.append("\n");

for (int j = 1; j <= i; j++)

t2.append (" * ");

private void r2ActionPerformed(java.awt.event.ActionEvent evt) {

int a = Integer.parseInt (t1.getText());

for (int i = 1; i <= a; i++)

t2.append("\n");

for (int j = 1; j <= i; j++)

t2.append (" * ");

} // TODO add your handling code here:

Q 10. Sagar electronics has the following products with their list price given. The store gives a 10% discount
on every product. However at the time of festival season, the store gives a further discount of 7%.
Note product name is stored in JListBox control.
private void cmdNetActionPerformed(java.awt.event.ActionEvent evt) {

float NetPrice;

NetPrice = Float.parseFloat(txtLPrice.getText()) - Float.parseFloat(txtDiscount.getText());

txtNPrice.setText(Float.toString(NetPrice));

private void cmdListActionPerformed(java.awt.event.ActionEvent evt) {

String Product = listProduct.getSelectedValue().toString();

if (Product.equals("Washing Machine")) {

txtLPrice.setText("12000");

} else if (Product.equals("Color Television")) {

txtLPrice.setText("17000");

} else if (Product.equals("Refrigerator")) {

txtLPrice.setText("18000");

} else if (Product.equals("OTG")) {

txtLPrice.setText("8000");

} else if (Product.equals("CD Player")) {

txtLPrice.setText("14500");

private void cmdDiscActionPerformed(java.awt.event.ActionEvent evt) {

float ProductPrice, Discount;

ProductPrice = Float.parseFloat(txtLPrice.getText());

// Calculating Discount Price


if (optFest.isSelected())

Discount = ProductPrice * 17 /100;

else

Discount = ProductPrice * 10 /100;

txtDiscount.setText(Float.toString(Discount));

private void cndExutActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0); }

Q10. Pg no : 156 Example 4.1

Q 11. Displaying string functions

private void btnStringActionPerformed(java.awt.event.ActionEvent evt) {

String Board = "CBSE";

String str = " Informatics Practices";

Board = Board.concat(str); // Concatenate str with Board

String str1 = "NetBeans IDE Programming";

int ln = str1.length();
String nStr = str1.substring(9); // Index starts from 9th position

String nStr1 = str1.substring(9, 13); // Index start from 9th position till 13th

String uCase = str1.toUpperCase(); // Converts into uppercase letters

String LCase = str1.toLowerCase(); // Converts into lowercase letters

String mess1 = " My Personal Bio-Data ";

String Year = "2009";

String nTrim = mess1.trim() + " " + Year;

txtStringArea.append("Concatenated string: " + Board + "\n");

txtStringArea.append("Length of '" + str1 + "' is: " + ln + "\n");

txtStringArea.append("str1.substring(9) is: " + nStr + "\n");

txtStringArea.append("str1.substring(9, 13) is: " + nStr1 + "\n");

txtStringArea.append("str1.toUpperCase() is: " + uCase + "\n");

txtStringArea.append("str1.toLowerCase() is: " + LCase + "\n");

txtStringArea.append("mess1 trim is: " + nTrim + "\n");

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

Q12 . Coding to concatenate two string along with the Input & Message Dialog Box.
import javax.swing. JOptionPane; // WRITTEN ON TOP

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

String str1 = JOptionPane.showInputDialog("Enter first string ");

String str2 = JOptionPane.showInputDialog("Enter second string ");

JOptionPane.showMessageDialog(this, str1 + " " + str2);

Q13. Program to perform String manipulations

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


String str = strtf.getText();
JOptionPane.showMessageDialog(rootPane, "Length = " + str.length());
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String str = strtf.getText();
int s = 1 ;
for(int i = 0;i<str.length();i++)
{
if(str.charAt(i) == ' ')
{
s++ ;
}
}J
OptionPane.showMessageDialog(rootPane, "N.of word = " + s);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
String str = strtf.getText();
int i ;
int vowel = 0;
for(i = 0; i<str.length(); i++)
{

switch(str.charAt(i))
{
case 'A' :
case 'E' :
case 'I' :
case 'O' :
case 'U' :
case 'a' :
case 'e' :
case 'i' :
case 'o' :
case 'u' : vowel++ ;
}
}J
OptionPane.showMessageDialog(rootPane, "N.of vowels are = " + vowel);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
String str = strtf.getText();
int i = 0; int j = str.length()-1;
int flag = 0 ;
while(i < str.length()/2)
{
if(str.charAt(i)!= str.charAt(j))
{
flag = 1 ;
break;
}e
lse
{
i++;
j--;
}
}i
f(flag ==1)
{
JOptionPane.showMessageDialog(rootPane, "It is not a palindrome");
}e
lse
{
JOptionPane.showMessageDialog(rootPane, "It is a palindrome");
}}

Q14. Program to Display,Update,delete,add and search the record from MySQL database to java Swing

import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.*;
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
Coding for Buttons
private void addActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","sql");
stmt=con.createStatement();
String name=t1.getText();
int rno=Integer.parseInt(t2.getText());
String q="insert into student values('"+name+"',"+rno+");";
int rec=stmt.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Record inserted successfully");
stmt.close();
con.close();
}
catch(Exception e)
{

JOptionPane.showMessageDialog(null,e.getMessage());
}}
private void deleteActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","sql");
stmt=con.createStatement();
String q="delete from student where rno="+t2.getText()+";";
stmt.executeUpdate(q);
JOptionPane.showMessageDialog(null,"Record deleted successfully");

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,e.getMessage());
}
}
private void editActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("java.sql.Driver");
int rno=Integer.parseInt(t2.getText());
con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","sql");
stmt=con.createStatement();
String name1=t1.getText();
String q="UPDATE student SET name='"+name1+"'where rno="+rno+";";
stmt.executeUpdate(q);
JOptionPane.showMessageDialog(null,"update done");
stmt.executeUpdate(q);

stmt.close();
con.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,e.getMessage());
}
}

private void searchActionPerformed(java.awt.event.ActionEvent evt) {


int rno=Integer.parseInt(t2.getText());
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","sql");
stmt=con.createStatement();
String q="select * from student where rno="+rno+";";
rs=stmt.executeQuery(q);
while(rs.next()){
String nm1=rs.getString(1);
t1.setText(nm1);
}
rs.close();
con.close();
stmt.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"ROllno not found");
}}
private void dispActionPerformed(java.awt.event.ActionEvent evt) {
DefaultTableModel model =(DefaultTableModel)table1.getModel();
try
{
Class.forName("java.sql.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","sql");
stmt=con.createStatement();
String q="select * from student";
rs=stmt.executeQuery(q);
while(rs.next())
{
String n=rs.getString(1);
int r=rs.getInt(2);
model.addRow(new Object[]{n,r});
}

rs.close();
stmt.close();
con.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"error");}
}

Q15. Design a JAVA application to navigate records in Student Table with following
assumption.
Database Name : School (created in MySQL)
Table Name: Student (with few test records)
Table Structure : (Roll Integer , Name Char(3), Class Integer )

// Import Required Libraries


import java.sql.*;
import javax.swing.JOptionPane;

Connection con=null;
Statement stmt=null;
ResultSet rs=null;

/*Code to connect MySQL Database when application loads*/


try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(="jdbc:mysql://localhost/school","root","");
stmt=con.createStatement();
rs=stmt.executeQuery("select roll,name,class from student");
/* Locate Cursor on first Record when application loads */
rs.next();
TxtRoll.setText(""+rs.getInt("roll"));
TxtName.setText(""+rs.getString("name"));
TxtClass.setText(""+rs.getInt("class"));
}
catch (Exception e)
{ JOptionPane.showMessageDialog(null,"Error in Connection"); }
}
private void BtnExitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
// Coding to close connection and Application
try{
rs.close();
stmt.close();
con.close();
System.exit(0);
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,"Unable to close connection");}
}

private void BtnFirstActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
// Coding for Button First
try{
rs.first();
TxtRoll.setText(""+rs.getInt("roll"));
TxtName.setText(""+rs.getString("name"));
TxtClass.setText(""+rs.getInt("class"));
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,"Error!!!");}
}

private void BtnPrevActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
// Coding for Button Previous
try{
rs.previous();
if (rs.isBeforeFirst())
rs.last();
TxtRoll.setText(""+rs.getInt("roll"));
TxtName.setText(""+rs.getString("name"));
TxtClass.setText(""+rs.getInt("class"));
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,"Error!!!");}
}

private void BtnNextActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
// Coding for Button Next
try{
rs.next() ;
if (rs.isAfterLast())
rs.first();
TxtRoll.setText(""+rs.getInt("roll"));
TxtName.setText(""+rs.getString("name"));
TxtClass.setText(""+rs.getInt("class"));
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,"Error!!!");}
}

private void BtnLastActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
// Coding for Button Last
try{
rs.last() ;
TxtRoll.setText(""+rs.getInt("roll"));
TxtName.setText(""+rs.getString("name"));
TxtClass.setText(""+rs.getInt("class"));
}
catch(Exception e)
{JOptionPane.showMessageDialog(null,"Error!!!");}
}
[ SQL Table : To be written in the Left side ]

Table: Department
Dept DName MinSal MaxSal HOD
10 Sales 25000 32000 1
20 Finance 30000 50000 5
30 Admin 25000 40000 7

Table: Employee
No Name Salary Zone Age Grade Dept
1 Mukul 30000 West 28 A 10
2 Kritika 35000 Centre 30 A 10
3 Naveen 32000 West 40 NULL 20
4 Uday 38000 North 38 C 30
5 Nupur 32000 East 26 NULL 20
6 Moksh 37000 South 28 B 10
7 Shelly 36000 North 26 A 30

[ SQL Commands : To be written in the Right side ]

Write SQL commands to:


Create Table
1. Create the table Employee.
create table Employee(No int,Name varchar(25),Salary int,Zone varchar(10),Age int,Grade
varchar(2),Dept int);
2. Create the table Department.
create table Department(Dept int,DName varchar(15),MinSal int,MaxSal int,HOD int);
Insert data in a table
3. Insert data in the table Employee
insert into Employee values(1,’Mukul’,30000,’West’,28,’A’,10);
4. Insert data in the table Department.
insert into Department values(10,’Sales’,25000,32000,1);
Simple Select
5. Display the Salary, Zone, and Grade of all the employees.
select Salary,Zone,Grade from Employee;
6. Display the name of all the employees along with their annual salaries. The Salary column of the table
contains monthly salaries of the employees. The new column should be given the name “Annual
Salary”.
select Name,Salary as “Annual Salary” from Employee;
Conditional Select using Where Clause
7. Display the details of all the employees who are below 30 years of age.
Select * from Employee where Age<30;
Using DISTINCT Clause
8. Display the names of various zones from the table Employee. A zone name should appear only once.
Select DISTINCT zone from Employee;
Using Logical Operators (NOT, AND, OR)
9. Display the details of all the employees who are getting a salary of more than 35000 in the department
30.
Select * from Employee where Salary > 35000 AND Dept=30;
10. Display the names and salaries of all the employees who are not working in department 20.
Select Name,Salary from Employee where Dept!=20;
11. Display the details of all the employees whose salary is between 32000 and 38000.
Select * from Employee where Salary > 32000 and Salary < 38000;
Using IN Operator
12. Display the names of all the employees who are working in department 20 or 30. (Using IN operator)
Select name from employee where Dept In(20,30);
Using BETWEEN Operator
13. Display the details of all the employees whose salary is between 32000 and 38000.
Select * from Employee where salary between 32000 and 38000;
14. Display the details of all the employees whose grade is between ‘A’ and ‘C’.
Select * from Employee where grade between ‘A’ and ‘C’;
Using LIKE Operator
15. Display the name, salary, and age of all the employees whose names start with ‘M’.
Select name,salary,age from Employee where Name Like ‘M%’;
16. Display the name, salary, and age of all the employees whose names contain ‘a’.
Select name,salary,age from Employee where Name Like ‘%a%’;
17. Display the details of all the employees whose names contain ‘a’ as the second character.
Select * from employee where Name Like ‘_a%’;
Using Aggregate functions
18. Display the highest and the lowest salaries being paid in department 10.
Select max(Salary),min(Salary) from Employee where Dept=10;
19. Display the number of employees working in department 10.
Select count(*) from Employee where Dept=10;
Using ORDER BY clause
20. Display the name and salary of all the employees in the ascending order of their salaries.
Select name,salary from Employee order by salary;
Using GROUP BY clause
21. Display the total number of employees in each department.
Select count(*) from employee group by dept;
22. Display the highest salary, lowest salary, and average salary of each zone.
Select max(salary),min(salary),avg(salary) from employee group by zone;
Using UPDATE, DELETE, ALTER TABLE
23. Put the grade B for all those whose grade is NULL.
update Employee set grade=’B’ where grade=NULL;
24. Increase the salary of all the employees above 30 years of age by 10%.
Update Employee set salary=salary + (salary * 10/100) where age > 30;
25. Delete the records of all the employees whose grade is C and salary is below 30000.
Delete from employee where garde=’C’ and salary < 30000;
26. Add another column HireDate of type Date in the Employee table.
Alter table Employee add column HireDate date;
JOIN of two tables
27. Display the name,salary of all the employees who work in Sales department.
Select e.name,e.salary from Employee e,Department d where e.dept=d.dept and d.dname=’Sales’;
28. Display the Name and Department Name of all the employees.
Select e.name,d.DName from Employee e,Department d where e.dept=d.dept;
29. Display the names of all the employees whose salary is out of the specified range for the corresponding
department.
Select e.name from Employee e,Department d where e.dept=d.dept and e.salary >=d.minsalary and
e.salary <= maxsalary;
30. Display the name of the department and the name of the corresponding HOD for all the departments.
Select DName,HOD from Department;
Creating a website along with the unordered list, image & links.
<HTML>
<HEAD>
<TITLE>Wildlife</TITLE>
</HEAD>
<BODY vLink=red aLink=blue link=Maroon bgColor=SilVer>
<FONT FACE ="Times New Roman" SIZE=2 >
<H1 align=center>What is Social Networking ?</H1>
</FONT>
<FONT FACE ="Times New Roman" SIZE=4 >
<Img align="right" border = "1" width=160 height=140
src="Image1.JPG">
<P align="justify">
Social networking is the grouping of individual into specific groups, like small
rural communities or a neighbourhood subdivision, if you will. Although social
networking is possible in person, especially in schools or in the workplace, it
is most popular online.
</P>
<P align="justify">When it comes to online social networking, websites are
commonly used. These websites are known as social sites.
</P>

<TABLE cellPadding=2 width="70%" align=center border=2


color="BLUE">
<CAPTION color="blue"><B>List of major social networking websites </B>
</CAPTION>
<TBODY>
<TR>
<TH bgColor=cyan>Name</TH>
<TH bgColor=cyan>Description/Focus</TH>
</TR>
<TR>
<TD>Advogato</TD>
<TD>Free and Open source software developers</TD>
</TR>
<TR>
<TD>ANobii</TD>
<TD>Books</TD>
</TR>
<TR>
<TD>Avatars United</TD>
<TD>Online Games</TD>
</TR>
</TBODY>
</TABLE>
<U><B>MENU</B></U>
<UL>
<LI><A href="one.html">Social Networking and Websites
<LI><A href="two.html">Should You Join
<LI><A href="three.html">Starting Your own Network
<LI><A href="[email protected]">Contact Us
</UL>
</BODY>
</HTML>
STUDENT REGISTRATION FORM

<html
>
<head>
<title>Student Registration Form</title>
</head>
<body>
<form action="student.html" method="post" name="StudentRegistration">
<table cellpadding="2" width="20%" bgcolor="99FFFF" align="center"
cellspacing="2">
<tr>
<td colspan=2>
<center><font size=4><b>Student Registration Form</b></font></center>
</td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" name="studentname" id="studentname" size="30"></td>
</tr>
<tr>
<td>Father Name</td>
<td><input type="text" name="fathername" id="fathername"
size="30"></td>
</tr>
<tr>
<td>Postal Address</td>
<td><input type="text" name="paddress" id="paddress" size="30"></td>
</tr>
<tr>
<td>Personal Address</td>
<td><input type="text" name="personaladdress"id="personaladdress" size="30">
</td>
</tr>
<tr>
<td>Sex</td>
<td>
<input type="radio" name="sex" value="male" size="10">Male
<input type="radio" name="sex" value="Female" size="10">Female
</td>
</tr>
<tr>
<td>City</td>
<td>
<select name="City">
<option value="-1" selected>select..</option>
<option value="New Delhi">NEW DELHI</option>
<option value="Mumbai">MUMBAI</option>
<option value="Goa">GOA</option>
<option value="Patna">PATNA</option>
</select></td>
</tr>
<tr>
<td>Course</td>
<td><select name="Course">
<option value="-1" selected>select..</option>
<option value="B.Tech">B.TECH</option>
<option value="MCA">MCA</option>
<option value="MBA">MBA</option>
<option value="BCA">BCA</option>
</select></td>
</tr>
<tr>
<td>District</td>
<td><select name="District">
<option value="-1" selected>select..</option>
<option value="Nalanda">NALANDA</option>
<option value="UP">UP</option>
<option value="Goa">GOA</option>
<option value="Patna">PATNA</option>
</select></td>
</tr>
<tr>
<td>State</td>
<td><select Name="State">
<option value="-1" selected>select..</option>
<option value="New Delhi">NEW DELHI</option>
<option value="Mumbai">MUMBAI</option>
<option value="Goa">GOA</option>
<option value="Bihar">BIHAR</option>
</select></td>
</tr>
<tr>
<td>PinCode</td>
<td><input type="text" name="pincode" id="pincode" size="30"></td>
</tr>
<tr>
<td>EmailId</td>
<td><input type="text" name="emailid" id="emailid" size="30"></td>
</tr>
<tr>
<td>DOB</td>
<td><input type="text" name="dob" id="dob" size="30"></td>
</tr>
<tr>
<td>MobileNo</td>
<td><input type="text" name="mobileno" id="mobileno" size="30"></td>
</tr>
<tr>
<td>
<input type="reset">
</td>
<td colspan="2">
<input type="submit" value="Submit Form" />
</td>
</tr>
</table>
</form>
</body>
</html>

You might also like