mysql

SQLite migration and administration

I wanted to migrate my production MySQL database to any other RDBMS. Someone suggested me to use SQLite. I have following queries: Is there any tool to migrate MySQL to SQLite? Any GUI tool to manage SQLite databases? How reliable it is for large production databases? ...

PHP cries Syntax Error on simple SQL WHERE clause.

mysql_query('SELECT ID FROM documents WHERE (Key="' .$theKey. '" AND Value="' .$theValue. '")'); Isn’t this right? Also tried with a semicolon at the end of the string, but no luck. Driving me crazy, PHP keeps spitting out: You have an error in your SQL syntax; check the manual that c...

printing solution for .NET front end, MYSQL backend

i will need to print an "x" according to the coordinates given to me from one of the tables in my database. im probably gonig to use c# to connect to mysql. i will probably have a winform that is 8.5 x 11 inches (The size of a regular sheet of paper) and i will populate the entire thing with labels of "x" and they will be invisible. e...

Slow query log in mysql

Hi, Can someone share how to enable slow query log (to see the slow queries) in Mysql 5 versions? I need to analyse the slow queries, please suggest. Thanks in advance. ...

MySQL and PHP Microsoft Windows Error - Any idea what's happening?

I'm running the following code: <?php $dbc = mysql_connect('myforeignserver.wisc.edu:3306','mydb','mypassword'); echo "This Works"; ?> Instead of generating a this works, like it should, I get a windows bar which pops up and says Apache HTTP Server stopped working and was closed. I really have no idea what the issue is. Pleas...

SQL Queries - Where to find more optimization tidbits like a=b AND b=c slower than a=b AND b=c AND a=c?

I was just wondering where I could find more information on these optimizations? Google searches tend to emphasize prepared queries and such, and not really at the angle of the abstraction the SQL provides. Source: http://www.joelonsoftware.com/articles/LeakyAbstractions.html The SQL language is meant to abstract away the procedur...

Create mysql backup from server, download locally with scp and replace mamp database

I'm creating a snippet to be used in my Mac OS X terminal (bash) which will allow me to do the following in one step: Log in to my server via ssh Create a mysqldump backup of my Wordpress database Download the backup file to my local harddrive Replace my local Mamp Pro mysql database The idea is to create a local version of my curren...

What is the best strategy to store user searches for an email alert?

Users can do advanced searches (they are many possible parameters): /search/?query=toto&topic=12&minimumPrice=0&maximumPrice=1000 I would like to store the search parameters (after the /search/?) for an email alert. I have 2 possibilites: Storing the raw request (query=toto&topicId=12&minimumPrice=0&maximumPrice=1000) in a table wit...

Types in MySQL: BigInt(20) vs Int(20) etcc...

I was wondering what the difference between BigInt, MediumInt, and Int are... it would seem obvious that they would allow for larger numbers; however, I can make an Int(20) or a BigInt(20) and that would make seem that it is not necessarily about size. Some insight would be awesome :), just kind of curious. I have been using mysql for a...

values not getting stored in the database

Hi everyone, I have a image slideshow each image sliding after 4 seconds and a message is displayed at end of each slide. I could record the message when button is clicked but couldn't record the message at the end of each slide if button is not clicked. Here is my code: and I also want to display random images without repetition. Can...

mysql: retrieve more than 1 linked field in same table

hi, i have 2 tables: teams: id_team name matches id_match id_team_1 id_team_2 score_1 score_2 I want to show the matches score by showing the team names. For example: Brasil 3 - Chile 0 This is what i've tried so far: SELECT * FROM match INNER JOIN team ON match.id_team_1 = team.id_team AND match.id_team_2 = match.id_team Of course...

help with insert mysql

Hi-- I have some data from an old table, with a lot of columns that I need to insert into a new table, with not quite as many columns. If you simply try to import the sql dump data from the old table directly into the new one, you get an error: Unknown column 'fake' in 'field list' Is there a way to make this ignore the errors (IN...

Insert a lot of data into database in very small inserts

Hi, So i have a database where there is a lot of data being inserted from a java application. Usualy i insert into table1 get the last id, then again insert into table2 and get the last id from there and finally insert into table3 and get that id as well and work with it within the application. And i insert around 1000-2000 rows of data...

In Django, how do I set the default so that every model is created with INNODB?

Right now, Django defaults to MYISAM...but I want to change it so that everytime I create a new table it is innodb. ...

MySQL's utf_general_ci in C#

Is there an easy way to replicate the behavior of MySQL's utf_general_ci collation in C#? In particular, given a Unicode string, I want to generate a(n ASCII?) string that can then be trivially sorted or compared, as utf_general_ci would. I found this question, which shows how to strip accents from strings, which looks like a similar b...

Consensus? MySQL, Signed VS Unsigned Primary/Foreign Keys

Hello, I have seen a couple threads about what everyone was doing now a days in regards to signed vs unsigned key values. It would seem that unsigned is optimal since it allows twice the number of rows for the same cost. Are there any benefits with signed keys? Is there any standard consensus? Its seems like signed is the answer since "...

How to query many to many

I'm trying to do a many to many query on these fields. I'd like to get: 1) all the posts that are in a category 2) all the categories that are in a post 3) all the posts that are in a category that have a specific id posts +-------------+--------------+ | id | int(11) | | title | varchar(255) | | body |...

Which implementations of SQL have PSM like functionality?

Although Oracle is one of the earliest to create stored procedures (PL/SQL) then Informix with (SPL) which RDBMS products besides DB2 have implemented SQL/PSM or a subset of it after 1998?.. Which RDBMS' can support procs like in the following example?: CREATE OR REPLACE FUNCTION foo1(a integer) RETURNS void AS $$ CASE a WHEN 1, ...

NHibernate: read/write splitting

I would like to connect NHibernate to a MySQL master-slave replication configuration, so I would like to send writes to the master, and reads to the master and slaves. Is this possible? I am also planning on having a load balancer to balance the reads. (ldirectord) ...

Database Design: Separate Live and Test databases for PHP Website

My organization is rewriting our database-driven website from scratch including a brand new database schema. In the current setup both live and test websites use the exact same database. We would like the next version to have a separate database for both live and test versions of the website. Updating the live version of the database ...