mysql

Insert data into sqlserver 2000 database, the order change, why ?

Insert 200 data througn for-loop into sqlserver 2000 database, the order change, why ? When I use mysql, it doesn't have the matter. i mean: when you insert 2, then insert 3, then insert 1, in mysql you will see 2,3,1 like the order you insert. But in sqlsever2000 that may not. ...

Generating SQL "IN" clauses: how to safely handle input + empty value lists?

In my Python code I often find myself doing the following (using DB-API): yValues = pickInterestingValuesOfY() sql = "..." # includes a clause stating that "y must be in yValues" c.execute(sql, yValues) In the end, the SQL being executed could be something as simple as SELECT x FROM table1 WHERE y IN (1,2,3); The issue is that th...

Is a varchar 2 more efficient than a varchar 255?

I'm using Django and setting my CharField(max_length=255), even though I only intend to use about 5 characters. Is this less efficient? I've read that it doesn't really matter with varchar but then read that it'll save hard drive space to specify only what you need. ...

How to create MySQL back up executable file?

I am using php, mysql and my server is Windows Server 2003 with IIS6. I am planning to backup my database on hourly basis. I can do the cronjob, tested by write date&time into a log file. It works perfectly. Now I want to use the cronjob to backup my databases. How do I do that? Create a php script and let it run every hour?? ...

File Name in the WHERE clause of Mysql returns nothing.

I have the this SELECT query that returns nothing from the specified table yet the path to the file is stored in that table; SELECT * from tableName WHERE imageFile = "C:\Documents and Settings\Albert Bayita\Desktop\MovieImages\TheLordOfTheRingsTheFellowship.jpg"; Any advice is appreciated. ...

php form errors

hello im trying to set custom errors. i got a form. actions to post.php i dont want form to go post.php for errors i need to set errors in same page. i tried $sql = " INSERT INTO yazilar (baslik, spot, spot_kisa, spot_resim, spot_resim_isim, icerik, kategori, tiklanma, eklemetarihi) VALUES ('$_POST[baslik]','$_POST[spot]','...

Recovering MySQl database from .frm, ibdata and ib_logfile

I have .frm, ibdata and ib_logfile from my previous version of MySQl and now I have shifting to a newer version. Unfortunately, I donot have the previous version installed so I cannot take the dump and import into the new MySQl version. Please suggest some way to get these databases running in the newer MySQL version. I have all the req...

sql optimize search many-many

usertable ---- id, username grouptable ---- id, groupname group_user -------- uid, gid books ---- id, groupname Input parameters: groupname, username output: list of books Is it possible to use 1 sql statement to get list of books when username is inside groupname Question 2: any good book to recommand to master complex sql st...

How to create an insert Form with TextInput containing ComboBox provided by mySQL Database Table

I have a Flex application which manage a database composed by 7 tables. I have created the insert form and all work great. Now I wanto to improve the Form performances; the idea is to replace the TextInput of the Form with ComboBoxes which are provided by the DataBase tables. Any ideas? Thanks in Advance ...

Migrating data from SQL Server to mysql using inserts

I am trying to migrate data from SQL Server to mysql, and i'd like to do that using insert-statements, so i modified this nice script by Narayana Vyas Kondreddi to generate mysql-friendly code and everything works fine so far. the problem being columns of the TEXT datatype that can be more than 8000 characters long (containing long blo...

Change from "unqiue=True" to "unique=False" in django.

Hi, I have a model with a CharField that earlier had "unique" set to True, but wich now is changed to False. But when i try to save that field with something that exists django still throws an IntegrityError. How can i change this behavior so that it allows non distinct values? The database is MySQL. ...

mysql: how can i remove the street number from a streetaddress column?

hi. I have a column named streetaddress that contains <Street Number> <Street Name> for example: 15 rue Gontier-Patin 4968 Hillcrest Circle how can i remove the numbers from the beginning of the row purely in sql? ...

How to define a column that can automate capitalizing?

So that when you insert 'abc',it'll be converted to 'ABC' automatically. I'm using MySQL,is it possible? ...

mysql: substring that returns the first occurance from the right ? (subrstring?!)

Hi. is there a way to return the first occurrence of a space from the right side of the string in sql ? thanks! :) ...

mysql - Order by relevance and views

I have seen there are a lot of 'order by relevance' posts on here... I have worked that part out... What I would like to achieve is search results that are first ordered by relevance and then by views. For example if I searched for 'dog' and my results both had the same level of relevance to 'dog' then I would like it to order them by ...

MySql query analyzer - free solutions

Hi, Is there a good (or not) Query Analyzer for MySQL (that's either free, or has a trial), than can analyze a query and make suggestions for indexes, like the "Display estimated execution plan" in Microsoft SQL Server management studio? Thank you, Frank ...

ZEND FW : Joining two tables from different databases

I want to join two tables in differenet databases on the same server. Could someone tell me how I could do this in Zend Frameworks Db adapter? ...

Conditional composite key in MySQL?

Hi So I have this table with a composite key, basically 'userID'-'data' must be unique (see my other question http://stackoverflow.com/questions/2026379/sql-table-semi-unique-row) However, I was wondering if it was possible to make this only come into effect when userID is not zero? By that I mean, 'userID'-'data' must be unique for no...

In mysql how do I find rows repeating with respect to all fields ?

+------------+------------+ | student | department | +------------+------------+ | 1234567890 | CS | | 1234567890 | ME | | 1234567890 | CS | | 000000001 | ME | +------------+------------+ How can I get rows that are repeating with respect to both fields? Thanks in advance. ...

Best way to show an admin message to certain users?

I am building a social network site in PHP/MySQL/jQuery. Once a user is logged into my site, I would like to query the DB and get an admin announcement if one exist. This will be a message box that shows on the page to all users but it will have an X to click on it and not show it ever again until the admin post a new announcement mess...