Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL mysql select statement
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


chitra
mysql select statement
1 Answer(s)      6 years and 5 months ago
Posted in : SQL



Advertisement
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
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
Advertisements
Mysql PHP Select
Mysql PHP Select       Mysql PHP is used to execute the select statement using mysql_query.... Understand with Example The Tutorial illustrate an example from 'Mysql PHP Select
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
SQL SELECT DISTINCT Statement
SQL SELECT DISTINCT Statement     ... with the select statement. The SQL Distinct clause is used with the Select statement...,'Santosh',10); Stu_Table The Select statement return you
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
select query in mysql
select query in mysql  Select query in mysql. Can anyone
SQL SELECT DISTINCT Statement
SQL SELECT DISTINCT Statement   ... clause with the select statement. The SQL Distinct clause is used with the Select... with the Select statement to get all unique records from database
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
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 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
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 Nested Select
Mysql Nested Select       Mysql Nested Select is a SELECT query that is nested within a Select, Update... illustrate an example from 'MySQL Nested Select'. To understand and elaborate example
MySQL Nested Select Example
MySQL Nested Select Example       MySQL Nested Select is select query, that is nested inside... with Example 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 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... The Tutorial illustrate an example from 'Mysql Where Statement'. To understand
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 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
Mysql Merge Statement
Mysql Merge Statement       Mysql Merge Statement is used to merge the two sql statement... in 'Mysql Merge Statement'.To grasp this example we create a table 'employee01
Mysql Merge Statement
Mysql Merge Statement       Mysql Merge Statement is used to merge the two sql statement using... in 'Mysql Merge Statement'. To grasp this example we create a table 'employee01
Mysql Cross Join Statement
Mysql Cross Join Statement       Mysql Cross Join Statement is used to return the product... illustrate an example from 'Mysql Cross Join Statement '. To understand
Select Records Using Prepared Statement
Select Records Using Prepared Statement   ... SelectRecords Select Records Example by using the Prepared Statement... to select some specific records by using the PreparedStatement. We know
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
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
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
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
 

 

 

DMCA.com