mysql

How do I filter a php array with a MySQL table?

Say I have an array of strings in a php array called $foo with a few hundred entries, and I have a MySQL table 'people' that has a field named 'name' with a few thousand entries. What is an efficient way to find out which strings in $foo aren't a 'name' in an entry in 'people' without submitting a query for every string in $foo? So I...

What is some good software for designing MySQL databases?

As above. Usually at work someone else does the database design, and when I do personal projects they're small enough to not really require more than five or six tables, but I'm about to start a personal project that I think will probably require around eleven or twelve tables and I'd like something to help me design it neatly and keep t...

Can you recommend a MySQL Book for an "intermediate" developer?

I'm a web developer looking to improve my MySQL skillset. Basic CRUD, joins, etc are all pretty par for the course; I'm looking to learn more about efficiency, avoiding bottlenecks, optimizing queries, and lots more awesome stuff that I don't know the words to explain. ...

C++ bindings for MySQL

I'm running OSX(10.4.11) & I'm trying to get a decent C(preferably C++) binding for MySQL figured out. I have some data in an offsite database I want to analyze. I'm trying to get MySQL++ working, but it's being funky. I'm looking for other bindings, preferably ones with a no-headache install. edit: MySQL has C bindings. Clunky and ...

Performance of recursive stored procedures in MYSQL to get hierarchical data

Hi, I have table employee like, employee ( emp_id int primary key, emp_name varchar(50), mngr_id int) and here mngr_id would either null or contain valid emp_id. This way it form the hierarchy of employees in the organization. In order to traverse the entire hierarchy I had to write the recursive stored procedure. (in Oracle it's eas...

mysql duplicate entry error when there is no duplicate entry (bulk load via php)

i am using mysql (5.0.32-Debian_7etch6-log) and i've got a nightly running bulk load php (5.2.6) script (using Zend_DB (1.5.1) via PDO) which does the following: truncating a set of 4 'import' tables bulk inserting data into these 4 'import' tables (re-using ids that have previously been in the tables as well, but i truncated the whole...

When attaching a file to an email, does it need to be stored on the server first?

I have a function that automatically exports a table into a CSV file, then I try to attach that same file into a function that will email it. I have sent attachments using html mime mail before, but I was wondering if that created CSV file needs to be stored on the server first before attaching it to the email? ...

Is there a MySQL command to convert a string to lowercase?

I have a MySQL database of keywords that are presently mixed-case. However, I want to convert them all to lowercase. Is there an easy command to do this, either using MySQL or MySQL and PHP? ...

How to use MySQL prepared statement caching?

How do i take advantage of MySQL's ability to cache prepared statements? One reason to use prepared statements is that there is no need to send the prepared statement itself multiple times if the same prepared statement is to be used again. Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysq...

MySQL, reading this EXPLAIN statement

I have a query which is starting to cause some concern in my application. I'm trying to understand this EXPLAIN statement better to understand where indexes are potentially missing: +----+-------------+-------+--------+---------------+------------+---------+-------------------------------+------+---------------------------------+...

how to Search multiple columns of a table in MySQL?

Given a table named "person" (in a MySQL database/schema), kind of like this one: code varchar(25) lastname varchar(25) firstname varchar(25) I'm trying to make a stored function to receive "code" or a part of "code" (which of course, is the code that identifies that person) and return a 'list' of suggestions of persons that have ...

Can you recomend a good MySQL stored procedure debugger?

Can you recommend a good MySQL stored procedure debugger? Extra points if it is open source, and works in linux :) Thanks! ...

My MySQL after INSERT trigger isn't working? Why?

I've created a trigger that resembles the following: delimiter // CREATE TRIGGER update_total_seconds_on_phone AFTER INSERT ON cdr FOR EACH ROW BEGIN IF NEW.billsec > 0 AND NEW.userfield <> NULL THEN UPDATE foo SET total_seconds = total_seconds + NEW.billsec WHERE phone_id = NEW.userfield; END IF; END;// It seems to go through okay...

Corel draw 13 mysql query

Is there a way to do a mysql database query in Corel Draw 13(X3)? ...

MySQL correlated subquery

Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and bar. foo has two fields of foo_id and total_count. bar has two fields, seconds and id. I need to aggregate the seconds in bar for each individual id and update the total_count in foo. id is a foreign key in bar for foo_id. I've tried ...

What is MySql equivalent of the Nz Function in MS Access? Is Nz a SQL standard?

What is MySql equivalent of the Nz Function in MS Access? Is Nz a SQL standard? In Access, the Nz function lets you return a value when a variant is null. Source The syntax for the Nz function is: Nz ( variant, [ value_if_null ] ) ...

Using Ruby-based MySQL adaptor when the C MySQL gem is already installed?

Well this is incredibly frustrating. After being nagged by Rails that I need to install the C-based MySQL adaptor, I did so... and then discovered that it won't work with MySQL under version 6. Now 'gem uninstall mysql' results in 'unknown gem mysql'. I just spent half an hour trying to get the thing to install in the first place (...

Checking registrations against a CSV file

I am new to MySQL and PHP(as you can probably tell) and I was wondering if anybody knew an easy way to import a CSV file into a MySQL table. "There are any number of ways to input csv into mysql depending in what kind of access you have, if you can use the mysql client directly there is a command to load delimited data, som...

How do I get count of duplicated values and join the table to retrieve each value's name?

I have two tables, one that contains volunteers, and one that contains venues. Volunteers are assigned one venue each. The id of the venues table (venues.id) is placed within the volunteers table in the venue_id column (volunteers.venue_id). I know I could get a count of how many matching values are in the volunteers.venue_id column by...

No suitable MySQL driver found for JBoss application

Hello, I am new to creating Java web applications and came across this problem when trying to interact with my database (called ccdb) through my application: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/ccdb/ My application runs on JBoss and uses Hibernate to interact with the MySQL database. I have the M...