mysql

Replicating database changes

Hi, I want to "replicate" a database to an external service. For doing so I could just copy the entire database (SELECT * FROM TABLE). If some changes are made (INSERT, UPDATE, DELETE), do I need to upload the entire database again or there is a log file describing these operations? Thanks! ...

How to optimize this query using better date comparsion in SQL?

Hello, I have problem with this query, complexity of this query is not good, i use this query from long time and now this database have many rows to get selecting by this method. All index'es is added propertly. I searching some other method to optimize this query by date comparsion because this is bottleneck in this solution. SELECT (...

DB Connection with MySQL via Hibernate on Embedded Glassfish

Hi! I have a problem to connect my MySQL Database via Hibernate/ JPA2 on a Embedded Glassfish. My Environment: Maven 2 Embedded Glassfish (integrated via Maven Plugin) Eclipse + M2Plugin Hibernate 3.5.6 MySQL (@localhost) (runs and can be connected without container via Hibernate Sessionfactory) Here is my Exception Stacktrace duri...

Simple way to automatically convert INSERT statements to UPDATEs?

I want to use the output of mysqldump to update entries in a live database. I don't want to delete the entries first, simple update statements are fine. Is there a simple way to convert the output of mysqldump which contains INSERT statements to the corresponding UPDATE statements? It seems such a basic feature, so I'm sure someone crea...

Shifting mysql database values from a couple of columns to rows of entries

Easier to describe by showing a simplified view of the existing data structure and the desired result... CURRENTLY... Element Response ElementType ElementNumber EntryVal.1 1234.56 EntryVal 1 EntryDes.1 'Current Value' EntryDes 1 EntryVal.2 4321.0 EntryVal 2 En...

One server, multiple domains, sharing PHP MVC

I'd like to produce regional versions of a php powered website, for example: www.mysite-england.co.uk www.mysite-wales.co.uk www.mysite-scotland.co.uk I'd like to setup one LAMP server to serve all the domains with a single php MVC using $_SERVER['HTTP_HOST'] (or similar) as the primary content modifier. Ie if($_SERVER['HTTP_HOST'...

updating a table column based on another tables results using mysql only

Hi everyone I have a set of results - SELECT id FROM recruit_index WHERE YEAR NOT LIKE '2011' I need to update another table column based on each of the above ids using mysql only. Could anyone point me in the right direction? Thanks in advance Mike ...

Does the order of fields in a WHERE clause affect performance in MySQL?

I have two indexed fields in a table - type and userid (individual indexes, not a composite). types field values are very limited (let's say it is only 0 or 1), so 50% of table records have the same type. userid values, on the other hand, come from a much larger set, so the amount of records with the same userid is small. Will any of ...

Invalid query: Column count doesn't match value count at row 1

I have a strange problem, I'm sending an SQL query through PHP: INSERT INTO `lib_plex` (`id`, `active`, `lastUpdated`, `entry_date`, `entry_ip`, `address`, `city`, `state_iso`, `zip_code`, `plex_type`, `price`, `has_garage`, `has_indoor_parking`, `has_outdoor_parking`, `has_pool`, `has_fireplace`, `average_nb_room`, `construction_year`,...

MySQL syntax error using python to add column to a table

The code i have is: for key in keys: cursor.execute(""" ALTER TABLE segment_table ADD %s VARCHAR(40) """, key) I get a error telling me my syntax is wrong. When I replace the %s with a actual string the syntax error goes away. for key in keys: cursor.execute(""" ALT...

Ruby Mysql Crashing

My ruby code crashes on this code puts "one" con = Mysql.real_connect('localhost', 'user', 'pass', 'database') puts "two" It outputs one but not two?? Why isn't it executing any further ...

PHP Timer security

I have a timer on the site which the user will only be able to click on every * seconds/minutes/hours. Every user has a timer value in the users table where the values are written and read. The value in the database is the amount of seconds that the user will have to wait. I've figured out how to make the timer countdown from the correc...

PDO MySQL call retruns unbuffered queries error

I have researched online but most examples or instructions don't seem to apply to what I am trying to accomplish. In short my code should accomplish the following: A stored procedure is called from my php script which returns a dataset I want to loop through and produce rows in a table (for online display purposes). One of the fields ...

Search mysql using multiple variable from multiple tables

I'm using php with mysql Hello I have a couple of tables with information about books. One table is like this id, bookTitle, BookText The other is like this id, bookid, amountofsales I would like to search the text of the book, and the book title from one table, but also be able to include amountofsales from the other table to give...

ConnectionNotEstablished error when loading any page

I am getting this ConnectionNotEstablished error whenever I try to access any page on my rails app. The error only started to occur when I installed phpMyAdmin and changed my database's password. I updated my database.yml file to reflect the change but am still getting this error. Does anyone have more details about what this error is o...

Execute multiple insert, update, queries separated by ";" at once!

I use remote server to store values into MySQL database. I don't use any SELECT queries, only INSERT, DELETE and UPDATE. When I execute 70,000 queries I have trouble with speed. I was trying mysql_unbuffered_query and I saw little performance profit but it's still too slow. I remember that some functions in PHP allow me to execute se...

MySQL - How to select rows where value is in array?

Ok, normally I know you would do something like this is you knew the array vals: SELECT * WHERE id IN (1,2,3) But... I don't know the array vals, I just know the value I want to find in a 'stored' array: SELECT * WHERE 3 IN (ids) // Where ids is stored as 1,2,3 Which doesn't work. Is there another way to do this? Thanks. PHP + MySQ...

Recommend please MySQL Profiler (preferably free).

I tried "Jet Profiler for MySQL", but I did not like ...

Conversion of Boolean value into String value in C#

I have a boolean field in a MySQL database. When displaying the selected rows from the DB on the datagrid in C#, I want this field to be displayed as "true" or "false". Can somebody help me out in telling how can I do it? ...

SQL query LEFT JOIN issue (MySQL)

I have 2 tables SCHOOLS (ID, SCHOOL_NAME, CITY_ID) STUDENTS (ID, STUDENT_NAME, SCHOOL_ID). I want to list schools in a particular city along with the student count (School Name| Student Count) One way to do this is to have co-related subquery - select sh.school_name, (select count(*) from student where s...