mysql select statement

mysql select statement

View Answers

October 1, 2008 at 11:34 AM

Hi chitra,

I am sending select statement code. Implement the following code.


import java.sql.*;
public class SelectState {
public static void main(String a[])
{
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String dbName = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName = "amar";
String password = "amar123";
try {
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+dbName,userName,password);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select Name from Employee");
System.out.println("Results");
while( rs.next() ) {
String data = rs.getString(1);
System.out.println( data );
}
st.close();
}
catch( Exception e ) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}


--------------------------------------------

Read for more information with example

http://www.roseindia.net/jdbc/

Thanks.

Amardeep









Related Tutorials/Questions & Answers:
mysql select statement - SQL
mysql select statement  i want to select id,name,age values from database.i created the following coding to select values from the table according to the id value which is selected by the user.pls help me select id,name,age from
How to use select Statement in MySQL?
How to use select Statement in MySQL?  Hi, How to use select Statement in MySQL? I want to learn the various ways to use the SQL select statement... the select statement in MySQL Suppose we have following table: CREATE TABLE
Advertisements
MySQL Select Statement
MySQL Select Statement     ... statement in MySQL and you can also learn how to use SELECT statement with WHERE clause. The SELECT statement is used to retrieve the records from the table
Mysql PHP Select
Mysql PHP Select       Mysql PHP is used to execute the select statement using mysql_query..._error()); mysql_select_db($database,$link) or die("Error in selecting
How to display all the rows in JSP ,MySQL select condition statement IN dept_table
How to display all the rows in JSP ,MySQL select condition statement IN dept_table  I iam unable to display all the rows in JSP select statement from MYSQL DB.i have used the below code:only first row that satisfy the condition
where clause in select statement
where clause in select statement  In Mysql,I write the following query: select * from emp where designation = "MANAGER" But the actual value in the table is "manager" Will the above query retrieve any records? According to me
Help with SELECT/JOIN statement
a select statement that will return me all rows of t1 but, when t1.id = t2.id, I...Help with SELECT/JOIN statement  I have two tables (t1 and t2... statement that will give me the result: id | name | value
select query in mysql
select query in mysql  Select query in mysql. Can anyone
SQL SELECT DISTINCT Statement
SQL SELECT DISTINCT Statement     ... with the select statement. The SQL Distinct clause is used with the Select statement... Stu_Table The Select statement return you the records from
The SELECT statement for SQL
The SELECT statement for SQL       SELECT key word is used to select data from a table. ADS..._TO_REPLACE_3 SELECT column_name(s) FROM table_name
update statement in mysql
update statement in mysql  i am looking for mysql update statement example. Thanks
Prepared statement JDBC MYSQL
Prepared statement JDBC MYSQL  How to create a prepared statement in JDBC using MYSQL? Actually, I am looking for an example of prepared statement.   Selecting records using prepared statement in JDBC
SQL SELECT DISTINCT Statement
SQL SELECT DISTINCT Statement   ... clause with the select statement. The SQL Distinct clause is used with the Select... from SQL Select Distinct Statement. The create table statement help you
SQL select statement doesn't return any rows,
SQL select statement doesn't return any rows,  When an SQL select statement doesn't return any rows, is an SQLException thrown
Select Statement in SQL, SQL Tutorial
The SELECT statement for SQL       SELECT key word is used to select data from a table. ADS..._TO_REPLACE_3 SELECT column_name(s) FROM table_name
update statement in mysql
update statement in mysql  Update statement to update the existing records in database table.   The given code creates a mysql connection... { Connection con = null Statement stmt = null
mysql select from multiple tables
mysql select from multiple tables   how can i select the date field from multiple tables in mysql?   "UNION" can be used to select data from multiple tables in my sql... for example (SELECT * from name where `name
mysql select into table from another table example
mysql select into table from another table example  Can you suggest the correct example of select into table from another table example in MySQL Database. Thanks   Hi, This statement is used to insert all the records
Mysql Where Statement
Mysql Where Statement       Mysql Where Statement is useful when we want to return the records..._TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Where Statement
Mysql Nested Select
Mysql Nested Select       Mysql Nested Select is a SELECT query that is nested within a Select, Update... The Tutorial illustrate an example from 'MySQL Nested Select'. To understand
JDBC Batch Example With SQL Select Statement
JDBC Batch Example With SQL Select Statement: In this example, we are discuss about SQL select statement with JDBC batch process. We will create SQL... will insert value in these table and then fetch data by using select statement
MySQL Nested Select Example
MySQL Nested Select Example       MySQL Nested Select is select query, that is nested inside... with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from 'MySQL Nested Select
JDBC Select Statement Example
.style1 { text-align: center; } JDBC Select Statement Example Select Statement retieves the data from single or multiple tables from a database... is used. At first create table named student in MySql database and inset values
Mysql Merge Statement
Mysql Merge Statement       Mysql Merge Statement is used to merge the two sql statement... covers you an example in 'Mysql Merge Statement'.To grasp this example we create
Mysql Merge Statement
Mysql Merge Statement       Mysql Merge Statement is used to merge the two sql statement using... you an example in 'Mysql Merge Statement'. To grasp this example we create
Mysql Cross Join Statement
Mysql Cross Join Statement       Mysql Cross Join Statement is used to return the product... The Tutorial illustrate an example from 'Mysql Cross Join Statement
Mysql Date Select
Mysql Date Select       The Tutorial elaborate an example from 'Mysql Date Select'. This section makes.... The SELECT DATE ('YYYY-MM-DD') is used to return the current selected date. SELECT DATE
Using Select Statements in JDBC
; The SELECT statement is used to select data from a table. For terminating... then we have to use SELECT statement. The Query can be written as below... with database and execute the Select Statement.   SelectState.java
Select Records Using Prepared Statement
Select Records Using Prepared Statement   ... to select some specific records by using the PreparedStatement. We know that the PreparedStatement object  represents a precompiled SQL statement. See brief
JDBC: Select Records using Prepared Statement
JDBC: Select Records using Prepared Statement In this section, you will learn how to retrieve records of table using Prepared Statement. Select Records ... the common sql query. Select statement is used to retrieve records from the table
How to select Data Between Two dates in Java, MySQL
How to select Data Between Two dates in Java, MySQL  How to select Data Between Two dates in Java, MySQL? Thanks in advance.   http://www.v7n.com/forums/coding-forum/294668-how-select-data-between-two-dates-php
Add values of drop down menu( select option) to mysql table
Add values of drop down menu( select option) to mysql table   Here...['valveId'].'<td>'; echo '<select name="onoff">'; echo '<..."; echo $change; } */ $query_auto="UPDATE valve set position='".mysql
for statement
for statement  for(int i=0;i<5;i++); { system.out.println("The value of i is :"+i); } if i end for statement what will be the output   got the answer.. it displays only the last iteration that is "The value of i
How to display all the Select values from the MySQL database table in where condition= In JSP?
How to display all the Select values from the MySQL database table in where condition= In JSP?  **Hi in jsp,SQL select statement,i am unable to display all the select values from MySQL DB** only first value is displayed
PHP SQL Select
; PHP SQL Select is used to execute mysql select query in the php application. The PHP SQL Select uses mysql_select_db () function that set the active MySQL... This example illustrates how to execute mysql select query in the php application
Select data from Table in Database
;    The Select Statement is used to retrieve...; in simple select statement is given below select column name from table;ADS... into a table country. The select statement is used to retrieve
PHP SQL IF Statement
by mysql_select_db("databaseName", connectionObject) and finally we execute query by mysql_query("SELECT * FROM tableName"). mysql_fetch_array...());   }   mysql_select_db("test", $con
PHP SQL IF Statement
the 'if' statement when accessing the data from mysql database table in php. ... created we choose database by mysql_select_db("databaseName", connectionObject) and finally we execute query by mysql_query("SELECT * FROM
SQL Select, HQL Select Example, HQL Select Query
HQL Select In this tutorial we will learn how to use HQL Select statement to load the Entity objects. The HQL Select query is used to load Entity based... is the complete example of HQL Select statement: package
Mysql Looping
Mysql Looping       Looping in Mysql is a simple loop construct,that enables the repeated execution of the statement list.This include one or more statements.Each
Mysql Looping
Mysql Looping       Looping in Mysql is a simple loop construct, that enables the repeated execution of the statement list. This include one or more statements. Each statement
MySQL Nested Example
MySQL Nested Example       MySQL Nested Select is select query, that is nested inside the select..._TO_REPLACE_1 The Tutorial illustrate an example from 'MySQL Nested Select
MySQL remove
MySQL remove       We can use MySQL Delete statement to implement the removal on the database. If you want to remove any record from the MySQL database table then you can use MySQL
SET and SELECT
SET and SELECT  hello, What is difference between SET & SELECT in sql????   hii,ADS_TO_REPLACE_1 SET : The set statement is used to the update query. SELECT : The select statement is used to display the all
JDBC Select Record Example
JDBC Select Record Example  In this tutorial we will learn how select specific  record from table use mysql JDBC driver. This  select...; "SELECT * FROM user WHERE  user_id=1"  , if  
Php Sql Select
Php Sql Select  This example illustrates how to execute mysql select... more select query for retrieving data from database but in this example we show mysql_select_db method, how it work and how it is used in php application
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it
Insert data in mysql database through jsp using Prepared Statement ---- Please..."); String connectionURL ="jdbc:mysql://localhost:3306/studentdb"; Connection...;Please visit the following link: http://www.roseindia.net/jsp/prepared-statement
Mysql Not
. Query for Mysql not : select !0 : The !0 in the select Query is used to return... for Mysql not : select !1: The !1 in the select Query is used to return 0.ADS... Mysql Not       Mysql
select query
select query  how to retrieve a single image from mysql table using $row[] value
PHP MySQLI Prep Statement
PHP-MySQLI:Prepared-Statement mysqli::prepare - Prepares a SQL query and returns a statement handle to be used for further operations on the statement... in this current statement:ADS_TO_REPLACE_1 Object oriented style Procedural

Ads