Fetching a random record [closed] - mysql

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
i am developing a ruby on rails question bank application.i want to know how to retrive a random records from database with out any duplication.and i am using a MYSQL as a database.Also all the random records show in the view.

Solution: 1
User.limit(10).order("RAND()")
Solution: 2
ids = User.pluck(:id).shuffle[0..9]
User.where(id: ids)

Sorry about my last, i write that almost thoughtlessly.
registers = YourModel.order("RANDOM()").limit(number_of_records)

Related

How to convert ruby query into mysql query [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Customer.select('email, status_id, COUNT(*) AS cnt').group(:email).having('cnt > 1').update_all(:status_id => 2)
above is my ruby query that I want to convert into mysql.
Please Help me. Please save my life.
Thanks
You can just append .to_sql to the end of your call. That will give you the SQL query.

How to create shared object(.so) from .cc files [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Can anyone please tell whether it is possible to create the shared object(.so) files from the existing .cc files?
Thanks !
Yes, you should look into make.
http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
You need to compile your object files and then create an shared object out of those.

Bash script: Save into mysql database [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have to save a variable of my bash script into my mysql database.
Any Ideas?
Use the mysql command, something like:
mysql -e "INSERT INTO tablename (colname) VALUES ('$variable')"

practice sql queries with database [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there any site where I can get good database with practice queries to solve. I am seeing a lot on internet, but mostly looks like beginner level.
Check out SQL Zoo: http://sqlzoo.net/
See http://www.w3schools.com/sql/default.asp ... I first started with that then I made up a database with 5 or 6 tables and tried myself subqueries and so on...

State of the art selfhealing and selfprotection in DBMS [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
at the moment I'm writing a paper and I need some input about the state of the art of selhealing and selfprotection in DBMSs. Does somebody read some interesting articles or books about this topics in the last few month? Doesnt matter which DBMS you have read about.
Regards
Perhaps this: Automatic Page Repair During a Database Mirroring Session.