You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2018/09/04 00:13:00 UTC

[jira] [Commented] (METAMODEL-1195) how to select a random record or row from a database table

    [ https://issues.apache.org/jira/browse/METAMODEL-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16602501#comment-16602501 ] 

Kasper Sørensen commented on METAMODEL-1195:
--------------------------------------------

There's no built-in facility in MetaModel to get a true random row or sample of rows. I guess it's worth asking if you want a true random row or just an arbitrary row? By "true random" I mean that you would get a new row every time you fired the query and it would be very unlikely to be the same one. If you're on the other hand just looking for an arbitrary record, then I'd just fire a query without any order by clause, granting you no specific ordering guarantees. Finally, if you're looking to build a true random sample of a table, you'll have to do that in your application. I could see us maybe providing a utility for doing that as part of MetaModel too.

> how to select a random record or row from a database table
> ----------------------------------------------------------
>
>                 Key: METAMODEL-1195
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1195
>             Project: Apache MetaModel
>          Issue Type: Bug
>            Reporter: Ashish Pancholi
>            Priority: Major
>
> I would like to select the random records from a table using Apache Metamodel, for example:
> *SELECT* * *FROM* table *ORDER BY* NEWID() ** 
> *OR*
> *SELECT* *** *FROM* ** table ** *ORDER BY* DBMS_RANDOM.VALUE
>  
> Please let me know how to run this above query using Apache Metamodel.
>  
> Thank You.
> ** ** **



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)