Column select

Ads

 
 

Share on Google+Share on Google+

Ankit Kumar
Column select
1 Answer(s)      5 years and 2 months ago
Posted in : JSP-Servlet

How i fetch Experience wise resume?

Ads
View Answers

July 10, 2012 at 4:06 PM


Create a column experience which consist of only two values either yes or no. Then using the query select * from resumes where experience='yes', fetch all the data of the corresponding candidate.

<[email protected] language="java"%>
<[email protected] import="java.sql.*"%>
<table border="1">
<%
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
String query = "select * from candidates where experience='yes'";
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
if(rs.next()){
%>
<tr>
<tr><td>Name</td><td><input type="text" name="name" value="<%=rs.getString("name")%>"></td></tr>
<tr><td>Address</td><td><input type="text" name="address" value="<%=rs.getString("address")%>"></td></tr>
<tr><td>Contact No</td><td><input type="text" name="contact" value="<%=rs.getInt("contactNo")%>"></td></tr>
<tr><td>Email</td><td><input type="text" name="email" value="<%=rs.getString("email")%>"></td></tr>
<%
}
}
catch(Exception e){}
%>
</table>

OR Create a column experience which consist of integer values, shows how many years of experience does candidate have. Then using the query Select * from candidates order by experience ASC, fetch all the data of the corresponding candidate. This query fetches the data according to the increasing order of experience, means having 0 years of experience should comes first. And if you want to display the candidates list based on experience from most experienced to fresher, then use this query Select * from candidates order by experience DESC.

<[email protected] language="java"%>
<[email protected] import="java.sql.*"%>
<table border="1">
<%
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
String query = "Select * from candidates order by experience ASC";
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
if(rs.next()){
%>
<tr>
<tr><td>Name</td><td><input type="text" name="name" value="<%=rs.getString("name")%>"></td></tr>
<tr><td>Address</td><td><input type="text" name="address" value="<%=rs.getString("address")%>"></td></tr>
<tr><td>Contact No</td><td><input type="text" name="contact" value="<%=rs.getInt("contactNo")%>"></td></tr>
<tr><td>Email</td><td><input type="text" name="email" value="<%=rs.getString("email")%>"></td></tr>
<%
}
}
catch(Exception e){}
%>
</table>

Ads









Related Tutorials/Questions & Answers:
Column select
Column select   How i fetch Experience wise resume?   Create a column experience which consist of only two values either yes or no. Then using the query select * from resumes where experience='yes', fetch all the data
How to align the select tags in a single column.
How to align the select tags in a single column.  I am developing a JSP page with struts tags. In the JSP page I have a form where the candidate... are being displayed in three different rows but I want them in the same column
Advertisements
Select data from Table in Database
; in simple select statement is given below select column name from table; The select query retrieve the record value of specified column in the syntax from table. select * from table; The select query retrieve all the column present
column matrix
column matrix  columan wise total matrix
column matrix
column matrix  columan wise total matrix
Blob column
Blob column  Hi all... How to store an excel file in Blob column? I m using oracle 11 g database
SET and SELECT
SET and SELECT  hello, What is difference between SET & SELECT in sql????   hii, SET : The set statement is used to the update query. SELECT : The select statement is used to display the all data's in the table
select query
select query  how to write select query with where clause having multiple variables. example: i want to select the data from DB in which i want to check againest two variable in where cluase. String sql = "select * from
select query
select query  how to retrieve a single image from mysql table using $row[] value
how to Change column name and Make a unique column.
how to Change column name and Make a unique column.   how to Change column name and Make a unique column.   Hi, Following queries are used to rename a column and to make a column unique. for rename a column- alter
How to Delete a column and Add a new column to database
How to Delete a column and Add a new column to database   How to Delete a column and Add a new column to database   Hi, The following query is executed for add and delete a column in a table- for drop a column
Select from select list + display
Select from select list + display  i have a select list containing... select EmpCode from the select list, the corresponding EmpName and DeptName should...;/div> <tr><td><b>Select:</b></td><td><
SQL Alter Column Name
SQL Alter Column Name       Alter Column Name in SQL is used to change or modify the name of column in a table. Understand with Example The Tutorial explain you
Hibernate Column
This tutorial explains the concept of column annotation in hibernate
rename the column in sql
rename the column in sql   How can i rename the column name in SQL
The SELECT statement for SQL
The SELECT statement for SQL       SELECT key word is used to select data from a table.  Syntax:           SELECT column_name(s
sql add comment to column
sql add comment to column  Sql query to add comments to column
SQL Alter Column Name
SQL Alter Column Name       Alter Column Name in SQL is used to change or modify the name of column... example on SQL Alter Column Name. In this Example, create a table 'Stu_Table
Mysql Alter Column Size
Mysql Alter Column Size       Mysql Alter Column Size is used to change the data size of a column in a table. Understand with Example The Tutorial illustrate an example
Altering a Column name in a table
Altering a Column name in a table  how to alter column name in MSSQL server 2005 the codesample given using "change" keyword alter table tablename change oldcolumnname to newcolumnname is not working
Excel Column change
Excel Column change  How to change sequence of columns in Excel sheet through Java
how I do select from select in hql
how I do select from select in hql  select RN from ( select rownum RN, dbid from ( select * from profile p where type = 1912 and name like... doesn't work select RN from ( select rownum RN, DBId from ( select distinct p
SQL Add Column Int
SQL Add Column Int       SQL Add Column Int is used to add new column, whose field data type is integer.  Understand with Example The Tutorial illustrate a SQL Add Column
Select Statement in SQL, SQL Tutorial
The SELECT statement for SQL       SELECT key word is used to select data from a table.  Syntax:           SELECT column_name(s
Mysql Alter Remove Column
Mysql Alter Remove Column       Mysql Alter Remove Column is used to redefine the table and remove the column from existing table. Understand with Example The Tutorial
column count using metadata
GET COLUMN COUNT USING "RESULTSETMETADATA"   In this program ,we will get column count using "resultsetmetadata ".Using resultset interface and metadata interface ,we can get properties of column
Mysql Alter Column
Mysql Alter Column       Mysql Alter Column is used to redefine the table and change the datatype of existing column. Understand with Example The Tutorial illustrate an example
MySQL Add Column
MySQL Add Column       MySQL Add Column tutorial explains you to add the column to the existing.... Understand with Example The Tutorial describes Add Column in MySQL. To understand
Mysql Alter Add Column
Mysql Alter Add Column       Mysql Alter Add Column is used to define the existing Table and add a new column to it. Understand with Example
Select Clause in hibernate.
Select Clause in hibernate.  Example of select clause of hibernate
html:select in struts - Struts
html select in struts  What is the HTML select in struts default value