mysql

Mysql: Calculate visit frequency.

I have this table CREATE OR REPLACE TABLE hits (ip bigint, page VARCHAR(256), agent VARCHAR(1000), date datetime) and I want to calculate googlebot visit frequency for every page. ... WHERE agent like '%Googlebot%' group by page ...

Image Gallery tie in with database?

I'm developing an image gallery for one of my customers, they want a very minimal, simple and easy user experience. The image gallery must contain a title and description of each image, we have created a app to upload the images and set titles and descriptions this is stored in a mySQL database. We're developing this site with php. Befo...

Force Specific Record to Top When Performing GROUP BY

I have the following MySQL query and tables from which I am querying: SELECT `Song`.`id`, `Song`.`file_name`, `User`.`first_name`, `Vote`.`value`, Sum(`Vote`.`value`) AS score FROM `songs` AS `Song` LEFT JOIN votes AS `Vote` ON (`Song`.`id`=`Vote`.`song_id`) LEFT JOIN `users` AS `User` ON (`Song`.`user_id` = `User`.`id`) GROUP BY `...

GIS: PostGIS/PostgreSQL vs. MySql vs. SQL Server?

I need to analyze a few million geocoded records, each of which will have latitude and longitude. These records include data of at least three different types, and I will be trying to see if each set influences the other. What database is best for the underlying data store for all this data? Here's my desires: I'm familiar with the DB...

MySQL won't update the last cell of the last row in a table

I'm using PHP and MySQL. MySQL will not update the last cell in my table. I can't figure out why. Basically, I do 10 INSERTs with a foreach() loop on an array. On each loop I use the following code: $sql = "INSERT INTO table1 (name, address, phone, date_time, process_started, process_ended) VALUES ('$name', '$address', '$phone...

java web app run in netbeans - SQLException: No suitable driver

hello, I am trying to run an application developed on another machine where it was perfectly running, so it should have something to do with the configurations on the machine I am trying to run it on now. I'm using netbeans 6.9, tomcat 6.0.26 and maven. When I try to run it, it gives me the following error: Sep 19, 2010 12:51:02 AM or...

minimize number of tables in MySQL?

Basic question about a good way of organizing data in a database. Let's say I have a search site for multiple stores. Each store has a number of products. What is the best way of organizing price and inventory data? I see two ways of doing this: a table for every store , with the first column or two identifying a product, a column for ...

MySQL connection taking time to open

I am using MySQL on wamp server. It takes 0.6 secs to establish a connection with mysql database, however when I use persistence connection it takes 0.035 secs. I read people comments on php manual and found that mysql_pconnect runs out of connections soon. Any suggestion how to improve connectivity time? ...

Simplifying this query?

Consider this query: SELECT table1.id, table1.review, table1.time, table2.author, table2.title FROM table1, table2 WHERE table1.id = table2.id AND table1.reviewer = '{$username}' ORDER BY table1.id I'm using the above quite a lot around my site's code. I find that adding the table prefixes etc. befo...

Mysql/PHP not displaying all rows...

Im creating a simple message board with php/mysql. Users enter their name and a message, javascript displays the message immediately, and php/mysql stores it in a database. When the page loads, it should display all the messages in the database in a formatted list. However, it seems that my php is displaying only some of the messages ar...

MySQL to MySQL clone with PHP

Anyone know of a PHP script that will clone an entire MySQL database to another on another server? As a sort of backup? ...

MySQL stored procedure vs function, which would I use when ?

I'm looking at MySQL stored procedures and function. What is the real difference ? They seem to be similar, but a function have more limitations. I'm likely wrong, but it seems a stored procedure can do everything and more an stored function can. Why/when would I use a procedure vs a function ? ...

best practice for maintaining ranking tables?

Using MySQL and PHP, I have a simple ranking table with 2 columns user and score. Once a week, I re-run the ranking script and it computes scores for each user. many users have new scores some do not some times there are new users to add to the table What's the best way to approach this with MySQL? Does update work if I need to add ...

Rules for MySQL type conversion

I'm wondering what the rules are for mysql type conversions are. e.g. select foo/2 from table seems to yield a decimal if the foo column is an int. select sum(foo) from table gives the sum(foo) column back as a double if foo is a float. select i*i from table gives a bigint if i is an int. What are the rules for the type conversion her...

how to check two database table for missing information.

i have two tables both have columns of fname and lname how would i write the query to check and see if one of the tables is missing a record that doesnt exist in the other table? here are the tables and its columns tbl_client -fname -lname tbl_lease -fname -lname i need to keep checking the tbl_lease to see if the records match the...

How to convert Apache Derby database to MySQL

I would like to convert an existing Derby database to MySQL. ...

Multiple tag search in an associative table scheme

I'm working with your standard three table tag setup item_table item_id item_name tag_table tag_id tag_name tag_map map_id tag_id item_id How this works should be obvious to anyone who has used a similar scheme for their tagging architecture, now, using this scheme I have a scenario in which I need to print the results of the...

Does mysql have cache about sql plan?

If the same sql run many times from different sessions, will mysql parse the same sql many times? In oracle/sql server, the plan for a sql is cached and can be reused. Since it is told that parse and creating sql plan is costly, if mysql doesn't cache them, will it be a problem to parse it many time which could potentially cost a lot? ...

Mysql: Calculate averge time between visits

This related to my other question. I have this table CREATE OR REPLACE TABLE hits (ip bigint, page VARCHAR(256), agent VARCHAR(1000), date datetime) and I want to calculate average time between googlebot visit for every page. ... WHERE agent like '%Googlebot%' group by page order by date Something ...

Cannot increment/decrement overloaded objects nor string offsets in php

I'm trying to make a simple php shopping cart. I don't have any idea how to make one myself so I tried searching and found this one the simplest to understand for a beginner like me:http://jameshamilton.eu/content/simple-php-shopping-cart-tutorial The only problem is I get the error mentioned on the title on this line of code: $_SESSIO...