mysql

PHpMyadmin German Language

Dear all, I am developing PHP/Mysql application using vertrigoserver, I need to enter the german text in Tables,The Problem is when i read the tables from php, some of character didnt show the exact typed one,Do i need additional steps to display all characters Effectively? ...

Rewrite Subquery(not in) as Join

Hi all is it possible to rewrite query: select userid from User where userid not in(select userid from UserRole where roleid in(8)); as Join? the problem is that one user may have several roles thank you in advance. mysql> desc User; +--------------------+-------------------+------+-----+---------+----------------+ | Field ...

Where is the best reference for MySQL 5.0 syntax?

Where can i find the manual for for MySQL 5.0 syntax? What i would need is the manual that corresponds to my MySQL server version (MySQL 5.0)? Considering this: I am using MySQL 5.0 and NaviCat for GUI. If i run this query: CREATE TABLE `genres` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `genre_name` VARCHAR( 25 ) NOT NULL `des...

Sparse data: efficient storage and retrieval in an RDBMS

I have a table representing values of source file metrics across project revisions, like the following: Revision FileA FileB FileC FileD FileE ... 1 45 3 12 123 124 2 45 3 12 123 124 3 45 3 12 123 124 4 48 3 12 123 124 5 48 3 12 123 ...

How would I go about creating a new MySQL table with the results of "myisam_ftdump -c"?

I'm using myisam_ftdump -c to dump the occurrences of words in my fulltext column. What's the simplest way to insert that information into a new MySQL table? Thanks for any help, it's appreciated. ...

Update mysql table with data from another table.

Is it possible to run an UPDATE command on mysql 5.0 with a sub select. The command I would like to run is this: UPDATE book_details SET live = 1 WHERE ISBN13 = '(SELECT ISBN13 FROM book_details_old WHERE live = 1)'; ISBN13 is currently stored as a string. This should be updating 10k+ rows. Thanks, William ...

Managing date formats differences between PHP and MySQL

I'm writing my first PHP app that has to directly deal with dates, and thus to directly deal with the fact that PHP and MySQL have different date formats. My question is: what's the most elegant way to manage this difference? I have the following two functions to manage the difference using php: function mysql_date($php_date) { r...

How to combine these two queries into one? (multiple joins against the same table)

Given two tables, one for workers and one for tasks completed by workers, CREATE TABLE IF NOT EXISTS `workers` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO `workers` (`id`) VALUES (1); CREATE TABLE IF NOT EXISTS `tasks` ( `id` int(11) NOT NULL, `worker_id` int(11) NOT NULL, `status` int(11) NOT NULL, PRIMAR...

URLs: Binary Blob, Unicode or Encoded Unicode String?

I wish to store URLs in a database (MySQL in this case) and process it in Python. Though the database and programming language are probably not this relevant to my question. In my setup I receive unicode strings when querying a text field in the database. But is a URL actually text? Is encoding from and decoding to unicode an operation...

Combine 2 counts with different where on the same table

Is there a better way of doing this ? SELECT (SELECT count(*) FROM `tbl` WHERE `status` = 0) as 'text1', (SELECT count(*) FROM `tbl` WHERE `status` > 0) as 'text2' text1 and text2 are headers. ...

Using API/Function calls or going for the Cron Job approach - An inquiry into dealing with transactions - How would you handle it?

Hey Everyone, I wanted to run something by you guys. I am starting a new project which is roughly the following: Important information: I am using PHP and MySQL Every minute I get a list of to-do transactions from an API from different users. Example: user1 send $1 to user2 userx send $2 to usera userw send $0.50 to user2 etc.. ...

Storing a date where only the year may be known

What's the best way to store a date value for which in many cases only the year may be known? MySQL allows zeros in date parts unless the NO_ZEROES_IN_DATE sql mode is enabled, which isn't by default. Is there any reason not to use a date field where if the month and day may be zero, or to split it up to 3 different fields for year, mon...

MySql and inserting data in a link table, how to?

What is the trick in MySql (Version 4) to write from PHP thtree Inserts and to be sure that we can link tables properly. [Table1]-[LinkTable]-[Table2] In the PHP code I create an Insert that add 1 row in table 1 and an other Insert that add an other row in table 2. I get both rows PK (primary key) with two SELECTs that return me the l...

What's wrong with my MySQL query?

I'm not getting any errors as such just a minor performance issue. EXPLAIN SELECT a.nid, a.title, a.uid, b.parent, b.weight, c.name, d.value FROM table1 AS a INNER JOIN table2 AS b ON a.vid = b.vid AND a.status = 1 INNER JOIN table3 AS c ON c.uid = a.uid INNER JOIN table4 AS d ON d.content_id = a.nid AND d.value_type = 'percent' AND d.f...

What is the cost of indexing multiple db columns?

I'm writing an app with a MySQL table that indexes 3 columns. I'm concerned that after the table reaches a significant amount of records, the time to save a new record will be slow. Please inform how best to approach the indexing of columns. UPDATE I am indexing a point_value, the user_id, and an event_id, all required for cli...

Why CakePHP doesn't support a foreign key with multiple columns

I searched in google for this without a good result. The only topic I found in the cakephp trac, was closed without a "real" explanation. Since CakePhp is like one of the rails ports for php and rails does support this. I would like to know why wont be sopport to this feature. ...

mysql query

Hi, I am having table in the below format. I need mysql query to get the no of rows perday when i give date between 2008-10-12 and 2008-10-13 Name | KW | KV | I | Date | ------+--------+------+------+---------------------+ UPS1 | 353.50 | NULL | NULL | 2008-10-12 00:54:36 | UPS1 | 352.50 | NULL | NULL | 2008-...

MySQL partitioning with ActiveRecord

I want to take advantage of the new partitioning in MySQL 5.1 but using a standard ActiveRecord model. The problem I have encountered is that to use the partitioning the primary key on the table must include the columns used in the partitioning function. (http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations-partitioning-keys...

How to store IPv6-compatible address in a relational database

How do I do that? Right now IPv6 will not be used, but I need to design the application in such a way as to make it IPv6-ready. It is necessary to store IP addresses and CIDR blocks (also BGP NLRI, but this is another story...) in a mysql database. I've alway used an INT for IPv4 + a TINYINT for masklen, but IPv6 is 128 bit. What kind o...

SQL Server / MySQL / Access - speeding up inserting many rows in an inefficient manner

SETUP I have to insert a couple million rows in either SQL Server 2000/2005, MySQL, or Access. Unfortunately I don't have an easy way to use bulk insert or BCP or any of the other ways that a normal human would go about this. The inserts will happen on one particular database but that code needs to be db agnostic -- so I can't do bulk...