Column select

Column select

How i fetch Experience wise resume?

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.

<%@page language="java"%>
<%@page 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.

<%@page language="java"%>
<%@page 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
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
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
rename the column in sql
rename the column in sql   How can i rename the column name in SQL
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
ModuleNotFoundError: No module named 'column'
ModuleNotFoundError: No module named 'column'  Hi, My Python... 'column' How to remove the ModuleNotFoundError: No module named 'column'... to install padas library. You can install column python with following command
ModuleNotFoundError: No module named 'column'
ModuleNotFoundError: No module named 'column'  Hi, My Python... 'column' How to remove the ModuleNotFoundError: No module named 'column'... to install padas library. You can install column python with following command
sql add comment to column
sql add comment to column  Sql query to add comments to column
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
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
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
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 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><
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
SQL Add Column Int
SQL Add Column Int       SQL Add Column Int is used to add new column, whose field data type... a SQL Add Column Int example .In this Tutorial we create a table Stu_Table using
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
Excel Column change
Excel Column change  How to change sequence of columns in Excel sheet through Java
MySQL Append Column
MySQL Append Column This example illustrates how to append two column value of a table. In this example create a select query to append the data of four column. Table
Delete a column
Delete a column       In this section, you will learn how to delete a column from database table...") @NamedQueries({ @NamedQuery(name="readAllRecords",query="SELECT st FROM Student
Changing column name
the column name: mysql> select * from... Changing column name      ... the data in the form of rows and columns. Column indicates the field while row
SQL SELECT DISTINCT Statement
to overcome the duplicate values from a column, we will use SELECT DISTINCT... SQL SELECT DISTINCT Statement     ... with the select statement. The SQL Distinct clause is used with the Select statement
Mysql Alter Rename Column
Mysql Alter Rename Column       Mysql Alter Rename Column is used to modify the table definition and rename the existing column of table. Understand with Example
How to display the data column on jsp
How to display the data column on jsp  My requirements: Display total error count of error description of each database server (column wise). like...); stmt=conn.createStatement(); query="select

Ads