Академический Документы
Профессиональный Документы
Культура Документы
PROGRAM ONE-------------------------------------------------------------------------
Design :
Output :
Design :
Output :
Aim : To make a program that counts integers between two given integers.
Design :
Design :
Design :
Output :
Design :
else if(femalerb.isSelected())
{ str = "Hello Ms. "+ name.getText()+" you are registered";}
JOptionPane.showMessageDialog(null,str);
Aim : Design an application in which user enters his chat ID and City
Design :
String name=t1.getText();
String city=(String)c1.getSelectedItem();
l1.setText("<html>Hi "+ name +", Welcome to W3schools.net<br>How is The Weather in "+city);
Output :
Design :
Output :
Design :
MsgDialog2.setVisible(true);
For OK Button:
System.exit(0);
Aim : To design that decides the eligibility of the user as per his age.
Design :
catch(NumberFormatException e){
JOptionPane.showMessageDialog(null,"Enter age as Numeric Value");
}
Output :
Aim : To create a table that can receive input of the user and also display total count of records.
Design :
Output :
Aim : To create a table that can receive input of the user and manage an address book.
Design :
Design :
Code :
ResultSet rs = null;}
if (ans == JOptionPane.YES_OPTION) {
try{stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,”Record successfully updated”); }
catch (Exception e ){
updBtn.setEnabled(false);
delBtn.setEnabled(false);}}
JOptionPane.showMessageDialog(null,”Error in deletion!”);}
deptnoTF.setText(“”);
dnameTF.setText(“”);
locTF.setText(“”);
updBtn.setEnabled(false);
Output :
Design :
if(rows>0)
model.removeRow(0);}}
emptyBtn.doClick();
Class.forName(“java.sql.Driver”);
Connection con=
Queries:
1. List the details of those employees whose annual salary is between 25000 and 40000.
SELECT * FROM empl where sal BETWEEN 2500 AND 4000;
2. Display the name of employees whose name contains ‘A’ as the 4th alphabet.
3. Display Name, Job and Salary of employees who do not have a manager.
5. Display details of employees who earn more commission than their salaries.
Queries:
1. For record with ID=4 update record with last Name, User ID and Salary.
5. Modify the salary and increases it by 1000, for all who get salary less than 5000.
Queries:
1. Display Name, Sex, Percentage of the Students.
3. Display name, age and marks of students whose age is greater than or equal to 14 from student.
4. Display name, age, aggregate of student whose aggregate is between 300 and 400. Order the
query in descending order of name.
SELECT name, age, aggregate FROM student WHERE aggregate BETWEEN 300 AND 400 ORDER BY
name DESC;
5. Alias any column name and use that name in another statement.
SELECT name, aggregate/5 “Percentage Marks” FROM student ORDER BY “Percentage NAME”;
Queries:
1. Write a query to join two tables empl and dept on the basis of field deptno.
SELECT empl.deptno, dname, empno, ename, job, sal FROM empl, dept WHERE
empl.deptno=dept.deptno GROUP BY empno ORDER BY empl.deptno, empno;
Queries:
1. Write commands to create the above tables with constraints. Delete on a primary key should be
cascaded to its foreign key.
CREATE TABLE employe (empno INTEGER NOT NULL, salary FLOAT, PRIMARY KEY (empno))
ENGINE=innodb;
CREATE TABLE employer (ID INTEGER NOT NULL, employee_no INTEGER, FOREIGN
KEY(employee_no) REFERNCES employer(empno) ON DELETE CASCADE) ENGINE=innodb;
2. Write a query to create two tables Tt1 and Tt2, such that a column of the table Tt1 is the foreign
key referring to table Tt2 (constraint name fk1).
CREATE TABLE Tt1 (A INTEGER NOT NULL PRIMARY KEY, B INTEGER NOT NULL);
CREATE TABLE Tt2 (C INTEGER NOT NULL PRIMARY KEY, D INTEGER NOT NULL);
ALTER TABLE Tt1 ADD CONSTRAINT fk1 FOREIGN KEY (B) REFERENCES Tt2(C) ON DELETE CASCADE;
5. In table empl, add a column named THRIFTPALN of datatype NUMBER with a maximum of 7
digits and two decimal places anda column named LOANCODE of datatype CHAR with a size of
one and integrity constraint that checks that loan code should be one of these: E, C, H, P.
ALTER TABLE empl ADD (Thriftplan NUMBER(7,2), Loancode CHAR(1) CHECK (Loancode
IN(‘E’,’C’,’H’,’P’)));