mysql

Any way to improve this slow query?

Its particular query pops up in the slow query log all the time for me. Any way to improve its efficiency? SELECT mov_id, mov_title, GROUP_CONCAT(DISTINCT genres.genre_name) as all_genres, mov_desc, mov_added, mov_thumb, mov_hits, mov_numvotes, mov_totalvote, mov_imdb, mov_release, ...

Retrieve a complete list of all Categories, Sub Categories, Sub Sub Categories, etc. in only one SQL query

I have following table structure and data in MySQL CatID CatName ParentCatID ------------------------------- 1 Shirts NULL 2 Short Sleev 1 3 Long Sleev 1 4 Collarless 2 5 Collar 2 6 Collarless 3 7 Collar 3 8 Square Cut 4 9 Round Cut ...

MySQL coalesce for some null, not all null

I have a MySQL query that checks an employee schedule DB and (thanks to a previous stackoverflow question) returns any days that the user is not working as "No Work", so that if the user isn't working on Thursday, the query fills in that date even though the date does not appear in the original result set (and so I don't have to fill in ...

MySQL Performance: Single table or multiple tables

Hiya, I have a 8 sets of data of about 30,000 rows for each set, the data is the same structure just for different languages. The front end of the site will get relatively high traffic. So my question is regarding MySQL performance, if i should have a single table with one column to distinguish which set the data belongs to (i.e. colo...

Problem in mysql when ordering by more than one column using ORDER BY FIELD

I have a MySQL query where I sort by field like this: "... WHERE (patterns.id IN($idsJoin)) $where ORDER BY FIELD($idsJoin2) LIMIT 0 , $numLines"; where $idsJoin2 is something like this: my $idsJoin = join(',',@ids); my $idsJoin2="patterns.id, ".$idsJoin; and "@ids it's an array with numbers I want to order...

MySQL: printing data just once for each grouping

I'm coding in PHP/MySQL and have the following query to fetch products and product group data: SELECT products.id,products.name,product_groups.id,product_groups.name FROM products INNER JOIN product_groups ON products.id=product_groups.id WHERE products.name LIKE '%foobar%' ORDER by product_groups.id ASC So this query fetches products...

What do you think the future holds for database technology?

The good old Relational Database Management System (RDBMS) has been around for quite some time now and is still, certainly in my opinion, the mainstay of the majority of production platforms/software applications. Recently there seems to be a great deal of hype in the community regarding relatively young database technologies such as Cl...

Advantages Of MySQLi over MySQL

What are the advantages of using MySQLi over MySQL? ...

Database vs. Front-End for Output Formatting

I've read that (all things equal) PHP is typically faster than MySQL at arirthmetic and string manipulation operations. This being the case, where does one draw the line between what one asks the database to do versus what is done by the web server(s)? We use stored procedures exclusively as our data-access layer. My unwritten rule ha...

MySQL duplicate entry error when no duplicate exists

EDIT: I seem to get the error listed below on every insert no matter what data I try to insert. So maybe my table was corrupted or something? Anyway, here's my question: I have a MySQL table CREATE TABLE `AcpConfig` ( `ndss_id` int(11) NOT NULL default '0', `acp_id` int(11) NOT NULL default '0', `run_date` date NOT NULL default...

PHP/MySQL: How to create a comment section in your website.

Instead of asking 'how to use PHP/MySQL to let users affect webpages' I'll ask this, because I learn better from projects and examples. So how would I incorporate a VERY basic comment feature using PHP and MySQL? ...

multiple mysql queries into one php two-dimensional array

I'm refactoring my code and just hit a snag. The first query in the code below gets the tab_id of the latest submitted tabs. The second Query gets the detail of each tab. In my old way of doing it, i embedded php and html and it was truly an utter mess. Right now I'd like to merge the 2 queries into 1 and/or load it into an array. feel...

MySQL Lowercase Table Names in Windows Uppercase names on Unix

I have a a problem whereby my production server runs Unix and my dev server runs MS Windows. The problem is that Windows is not case sensitive and Unix is. So my table set on the production server uses Uppercase table names ie "Customers" and on Windows the table names are in lowercase "customers". All this is fine until you need to ge...

How can I insert a post into wordpress and associate it with a category?

I have content from elsewhere that I would like to insert as a post in Wordpress and then associate with an existing category. It is pretty straightforward to insert a new post into the wp_posts table, but I can't seem to figure out how to construct a query to both insert a new post and at the same time associate the post with a categor...

PHP CMS Plug ins require others

Hi! I'm writing a CMS, but I've got a problem. I have a mysql table called modules. Modules are similar to Wordpress' plug-ins, or Drupal Modules. Some modules require functions of other modules. I'm now writing the part which includes the modules. Here's my code: //Load modules $res_modules = mysql_query("SELECT * FROM ".$db_prefix."m...

Mismatch between MySQL and Python

I know the mismatch between Object Oriented Technology and the Relational Technology, generally here. But I do not know the mismatch between MySQL and Python, and other tools, not just ORMs, to deal with the issue, missing in the latter article. Questions: How is the problem dealt between MySQL and Python? Does App Engine's non-SQL...

Problem with UTF-8 in Create Schema By Hibernate

Hi every one, this is My hibernate.hbm.xml and I use MySQL <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; <hibernate-configuration> <session-factory> <property name="hibe...

Can I make this MySQL staement with complex COUNTs more efficient?

I have a table of all Major League Baseball games that is structured like this: **Game** id (int) home_team_id (int) away_team_id (int) home_score (int) away_score (int) date (date) I also have table named "ticket" that has tickets sold to different games: **Ticket** id (int) game_id (int) price (float) time_sold (datetime) I'd lik...

Private Messaging System With Threading/Replies

Hello All, I'm currently working on creating a private messaging system, (PHP/MySQL) in which users can send message to multiple recipients at one time, and those users can then decide to reply. Here's what I'm currently working with: tbl_pm tbl: id date_sent title content status ENUM ('unread', 'read') DEFAULT 'unread' tblpm_info t...

Is there a standard mysql connection pooling library for C?

I have a C application using the MySQL library for database access. Is there a standard way to implement database connection pooling for such an application? The C connector doesn't appear to support it. ...