As an example, say I have a these tables...
person (id, currentyear)
personteam (id, workyear, team)
A person is assigned a team for each year they work at a company. 'personteam' stores a record of the teams. The insert into 'personteam' is only allowed if the 'currentyear' field in 'person' equals the 'workyear' in 'personteam'.
I ...
I need to move a database with a Django schema from Postgres to MySQL, running on Amazon's RDF. I can re-generate the tables using manage.py, but I'm still looking for a way to migrate over all of the row data. Does anyone know a clean way of moving it over? Are there any gotchas to watch out for with Amazon's RDF?
...
I am working on a java project and I need to pull some values out of a database and turn them into variables the program will then use to make a billing statement. I can get the program to connect to the database just fine, and the mySQL statement to call the data I need is easy enough. I just can't seem to figure out how to then have ...
I'm trying to some something like that:
INSERT INTO dir_pictures SET filename=CONCAT(picture_id,'-test');
picture_id is my primary key, auto-increment. Basically I'm trying to put the id of this insert statement, in the statement itself.
I'm sure it can be done with some extra PHP code or using more than one statements, but I was won...
Hello all,
I'm currently using SwiftMailer to send out emails to several users (up to 50). I have it set up and working properly, however, I'm not quite sure how to pull the recipients from my MySQL database and iterate to send them.
Here is what I currently have:
<?php
require_once 'swift/lib/swift_required.php';
$mailer = Swift_M...
How do I connect from Java to a MySQL database? The Java is run on a local machine while the Database is on a server.
...
Hi,
We are looking at database replication for rolling deploys. It gets complicated as our deploys involve data migrations too. What would be a good replication scheme.
I guess my question is on how to setup the replication.
Supposing we have 4 webservers and 2 database servers, how do I make the update so that all the writes are repl...
I have a table(users) with columns as
id INT AUTOINVREMENT PRIMARY
uid INT index
email CHAR(128) UNIQUE
activated TINYINT
And I'll need to query this table like this:
SELECT * FROM users WHERE uid = ? AND activated = 1
My questions is, since there's an index set on the 'uid' column, in order to get the best performance for the abo...
Looking to use Sphinx for site search, but not all of my site is in mysql. Rather than reinvent the wheel, just wondering if there's an open source spider that easily tosses its findings into a mysql database so that Sphinx can then index it.
Thanks for any advice.
...
not sure if this is a question better suited for serverfault but I've been messing with amazon RDS lately and was having trouble getting 'file' privileges to my web host mysql user.
I'd assume that a simple:
grant file on *.* to 'webuser@'%';
would work but it does not and I can't seem to do it with my 'root' user as well. What gives...
My py-mysql is farking because I've upgraded MySQL which replaced libmysqlclient_r.15.dylib with libmysqlclient_r.16.dylib. How do I find and get back the older version?
EDIT: I found that to intall an older version of MySQL, I need to do @, but I'm still looking for the way to find the older versions.
...
If I have in my php app an object that connects to the database, lets say I am using mysqli as on object for my database transactions.
example:
$dbase = new mysqli('localhost','dbuser','dbpass','dbname');
$oresult = $dbase->query("SELECT `field` FROM `table` WHERE `otherfield` = 12;");
if($oresult->num_rows > 0) {
$row = $oresult->...
The current situation is that topics are sorted by 3 main categories. There is the potential to add more than just the 3 categories but the higher ups wish to implement the ability to add more than just 1 category to a topic.
My original db design has the the categoryID as a Foreign Key in the topic info table. Which was probably a ...
I'm stumped on the ideal method of dealing with a relatively large number of table fields, and whether or not they should be split off into separate relational tables.
I've got a set of tables for a web-based game of sorts, holding player data, item data, class data, etc. For each one of these (player/item/class) I also need to record a...
It is taking .6-.8 seconds for this line of my code to execute in my users table model:
$row = $this->fetchRow("username = '$username'");
I'm caching my table metadata for all tables already.
Any idea what could be causing this slowness?
...
According to mysql document
"Encoding with a 128-bit key length is used, but you can extend it up to 256 bits by modifying the source."
But they didn't seem to provide instruction where to change. Anyone experience with this situation? which source file should change?
Note: I use these steps to compile.
...
I am trying to write a procedure that will fire the same select query till the number of results are more than 0. If the "interval 2 hour " returns 0 records then the "interval 4 hour" criterion should be used and if there are still no records fetched, then
lastupdate > current_date() should be used in the where clause.
These are the 2...
I'm trying to update one table based on values in another table. What's wrong with the following request? Error: Unknown column 'source.col3' in 'where clause'
UPDATE target
SET target.col1 = source.col1 * target.col2,
WHERE target.col3 = source.col3
...
Is it possible to have a SELECT statement in mySQL with an IF/ELSE clause in it?
E.g.
I want to SELECT all table rows and return color2 ONLY if color2 is 'brown'. My example SQL select statement of what I would like to accomplish is below.
APPLES
+------+--------+----------+----------+
| ID | NAME | COLOR1 | COLOR2 |
+--...
I am studying the new Amazon RDS product and it seems it can be scaled only vertically (i.e. put a stronger server).
Did anyone see a possibility to configure multiple instances so that one is master and the other/s is/are replication slaves?
...