Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: ColdFusion Database Related How to select a random record from a table. Tutorial

This guide will teach you how to select a random record from a table.

Tutorial Details:

Select a random record from a table

This example leans toward MS Access, while you can use the same technique on any database. It might not be the best (read performance) way to accomplish this. Continue reading and at the end I will provide you with some tips for other databases.

First build up a query that selects all the values of primary key column.


select bannerID from banners


Now we will create a list of all available id's.


Now we can pick a random id from the list with the RandRange function.


The function Randrange(number1,number2) returns a random integer between two specified numbers.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
ColdFusion Database Related How to select a random record from a table. Tutorial

View Tutorial:
ColdFusion Database Related How to select a random record from a table. Tutorial

Related Tutorials:

Use a RandomAccessFile to building a low-level database - JavaWorld January 1999
Use a RandomAccessFile to building a low-level database - JavaWorld January 1999
 
Use JDBC for industrial-strength performance, Part 1 - JavaWorld January 2000
Use JDBC for industrial-strength performance, Part 1 - JavaWorld January 2000
 
Build an object database - JavaWorld January 2000
Build an object database - JavaWorld January 2000
 
XSL gives your XML some style - JavaWorld June 2000
XSL gives your XML some style - JavaWorld June 2000
 
Get disconnected with CachedRowSet , This allows for ResultSet s to be serialized, sent to remote clients, updated
The new J2EE RowSet implementation provides updateable disconnected ResultSets in your JSPs
 
XML APIs for databases - JavaWorld January 2000
XML APIs for databases - JavaWorld January 2000
 
Access the world's biggest database with Web DataBase Connectivity - JavaWorld March 2001
Access the world's biggest database with Web DataBase Connectivity - JavaWorld March 2001
 
Build database-powered mobile applications on the Java platform
Build database-powered mobile applications on the Java platform
 
Accelerate EJB 2.0 development with EJBGen
Accelerate EJB 2.0 development with EJBGen
 
Navigate data with the Mapper framework
Navigate data with the Mapper framework
 
Customize SwingWorker to improve Swing GUIs
Customize SwingWorker to improve Swing GUIs
 
High-availability mobile applications
High-availability mobile applications
 
SQL Database Access with DBTags
SQL Database Access with DBTags In a J2SE or J2EE application, Java Database Connectivity (JDBC) can be used to create a connection with a SQL database, create database tables, retrieve result sets, and update the database. To use a database from a Jav
 
Accessing the Database from Servlet
This article shows you how to access database from servlets. Here I am assuming that you are using win95/98/2000 and running Java Web Server.
 
Backing Up and Restoring A MySQL Database
Backing Up and Restoring A MySQL Database Backing Up and Restoring A MySQL Database This tutorial explains the how to backup and restore the MySQL Database. Databases are used to store large amount of precious data and it becomes very important to
 
Sun Repricing Select Sun StorEdge 3000 Arrays
To provide customers with affordable storage products, Sun is reducing its price on the Sun StorEdge 3310 SCSI Array, Sun StorEdge 3510 FC Array, and Sun StorEdge 3511 FC Array with SATA.
 
Using Lucene With OJB
Brian McCallister looks at the Lucene search engine and shows us how to index and retrieve objects from a sample Student application.
 
Accessing Database from servlets through JDBC!
Accessing Database from servlets through JDBC! Accessing Access Database From Servlet T his article shows you how to access database from servlets. Here I am assuming that you are using win95/98/2000 and running Java Web Server. For the sake of
 
Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with JSP & Servlets. Using MYSQL Database with JSP & Servlets. MY SQL is a powerful RDBMS, which can handle large amount of data. And more interestingly it is free to use, except for some commercial use. you can download it
 
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page Connecting to MySQL database and retrieving and displaying data in JSP page This tutorial shows you how to connect to MySQL database and retrieve the data from the
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.