MySQL what's the best way to select X random entries (rather than just one) - optimization for heavy use, i.e. on main page of a domain.
Supposedly just blindly using MySQL rand() is going to make this rather scary for large databases - please give me a better optimization answer than that!
...
In MySQL, is it necessary to surround tablenames with the tickmark? I've often seen code snippets that use the tickmarks, but I've not encountered a case where not surrounding a tablename with the tickmarks does anything different than with.
It looks like the framework I work with automatically parses reserved word keynames with tickm...
I have the following table:
id | parent_id | quantity
-------------------------
1 | null | 5
2 | null | 3
3 | 2 | 10
4 | 2 | 15
5 | 3 | 2
6 | 5 | 4
7 | 1 | 9
Now I need a stored procedure in mysql that calles itself recursivly and returns the computed quantity.
For example the i...
Hi:
I am interested in examples using php and mysql of point systems. For example, for a given action on the website, users would receive varying amounts of points that could be redeemed for things.
Thanks,
Cire
...
when i try to update one table(GLOBAL_VARIABLES) from information_schema db,
i get an error :
Access denied for user 'root'@'localhost' to database 'information_schema'
Although I am root user with all privileges ,
how can i fix permission. ?
or how can i update this table ?
thanks.
...
I currently implement some kind of version control for values in a table. I have a composite primary key between bookingId and revision. I want to be able to select all records from this table which are the head revision? I am not sure what I should be doing.
[ bookingDetailsTable ] :
[ bookingId ]
[ revision ]
[ name ]
etc...
SELE...
Yesterday I had a question where people suggested I use Levenshtein method. Is it a slow query? Maybe I can use something else?
...
Does anyone have any ideas, links or algorithms for solving an anagram with PHP and MySQL. If anyone has a good English Dictionary that would be appreciated also.
I am looking to achieve something similar to this:
http://www.ssynth.co.uk/~gay/anagram.html
The guy explains how he did it here http://www.ssynth.co.uk/~gay/anagabout.html ...
I'd like to store a fair bit of text data with the following structure:
1. Overall Text A
1.1 Subsection Text
1.1.1 Clarification A
1.1.2 Clarification B
1.2 Another Subsection
1.2.1 Don't forget A
1.2.2 Don't forget B
1.2.3 or C!
2. Overall Text B
2.1 getting the idea yet?
Section levels would...
I am a bit lost, this looks like some silly mistake - but I have no clue what that can be. Here is the test session:
mysql> drop table articles;
Query OK, 0 rows affected (0.02 sec)
mysql> CREATE TABLE articles (body TEXT, title VARCHAR(250), id INT NOT NULL auto_increment, PRIMARY KEY(id)) ENGINE = MYISAM;
Query OK, 0 rows affected (...
Hi,
I am building a website with individual user customization in mind. So for instance, client #1 may say i want this feature to be designed for my account and then user #2 may say i want this added to my account. I was thinking of implementing a php if code where upon authentication those features will be loaded each time they login...
Hey I'm a beginner in mySQL, this is the code that i wrote,`
<?php
echo "Here is the table";
$con = mysql_connect("localhost","root","mypassword");
if(!$con)
die('Error:'.mysql_error());
// Create table
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE persons
...
First of all: I have fruitlessly tried searching Stackoverflow.com for any clues on my problem, however if I have missed anything, please let me know!
In my database I have a table containing metadata (i.e. description etcetera) and some other information (file names, etc) about a number of files.
I'd like to provide the users with...
hi
i am using c# and mssql. i send parameters from c# to sql and execute a query but sometimes it comes null values. i m using sql like function. it is great for string values but has problems with bool. for example
bool b = NULL
query executes like that: .... WHERE B LIKE '%%'
and it never returns a value.
i want to detect null value ...
Hello,
I've been trying to get a simple skeleton app to run (and commit to the DB) using JPA, MySQL, Hibernate & Maven, however I'm having problems.
Listed below are my 2 trivial classes, my pom.xml, and my META-INF/persistence.xml
I can build the project without any problem (mvn clean install), however running it (mvn exec:java -Dexe...
I ran a query that resulted in the string '1,2,3,4'.
How can I run a second query that treats that string as a list of numbers. So I'll be able to do:
select * from tbl where name not in (1,2,3,4)
I would like an answer in pure MySQL.
...
Hi,
I am new to cakephp and have been working through the Apress book "Beginning CakePHP from Novice to Professional" but have ran into a problem after the baking chapter.
(If you've seen my other recent question, you'll know that I had to skip that chapter because I cant get the bake console working on my win7 machine).
The problem i...
Hi.
There's a site containing dozens of text snippets, each of them may have links and I need to build connections between snippets. Snippets are stored in database, database layout is following:
snippet: id primary key, title varchar(255), url varchar(400), body text
references: snippet_id, crc32_sum
backlinks: snippet_id, links_to
p...
Hello.
I'm Writing a facebook application using the Java-facebook-api
and MySQL 5.1.
I'm trying to find a faster way to store the friends list of a user who logs into my application.
When a user logs into my application the following happens:
deleting the old friends list of the logged-in user
gathering the user friends list into an...
I have a MySQL table data type integer field. the value is stored as 1, 2, 3 .., 10000.
I want to format it with starting from 00001, 00002, 0003 etc., (the whole number to be 5 digit).
Is there any function to do?
or how do i set it manually in phpMyAdmin..
...