mysql

MySQL newbie question

I have two tables: CREATE TABLE pagelets ( `netloc` INT(32) unsigned NOT NULL, `page_key` BIGINT(64) unsigned NOT NULL, `pagelet_serial` BIGINT(64) unsigned NOT NULL, --that this is unique `pagelet_shingle` BIGINT(64) unsigned NOT NULL, `delete_me` BOOLEAN NOT NULL, KEY ( `pagelet_shingle` ) ) ENGINE=MyISAM...

MySQL vs PostgreSQL on Windows

I am torn between PostgreSQL and MySQL. I am forced to install the chosen one on Windows. I especially need ASP.NET Membership and NHibernate as well. ...

After installing MySQL 64 Bit on Snow Leopard is it possible to migrate the old data?

Hey, in /usr/local i now have two mysql folders: mysql-5.1.34-osx10.5-x86 mysql-5.1.37-osx10.5-x86_64 is it possible to migrate the data from my old mysql folder to the 64 bit one? Thanks for help, dont really want to setup all my databases again :) ...

Going to Oracle from MySQL

I'm starting a new semester and for my class "relational databases" they are using Oracle. Now I'm experienced in using MySQL and was wondering what the main differences are between Oracle and MySQL. So I have a couple of questions. What are the fundamental differences in using the database? What are some of the differences in SQL syn...

ms-access: instead of rowsource, running from query

i have a very complex query that is running from a listbox rowsource. i just do a listbox1.requery and it populates the listbox. instead of doing it this way, i would like to: i just want to save the query in the queries section call it from there. then i want to save the results of the query into a string then i want to feed the stri...

Recommendations on a sql comparison (schema & data) tool that supports both Oracle and SQL Server?

I'm trying to find a good tool (open source or commercial) for doing comparisons of database instances, for example: Compare 2 database schemas; generate platform specific change script (either direction) to bring one into synch with the other Compare data (table contents), generate platform specific change script (either direction...

Need help adding a conditional COUNT() to a query already using JOINs

Here's what I need to fetch: - posts that have comments - number of comments per post - number of unread comments per post (expressed by a bool "read" column in the "comments" table) The last part is what I'm having trouble with. Here's my SQL so far: SELECT posts.id , posts.title , COUNT(comments.id) AS commentsCo...

Need a tool to convert postgres database to mysql.

I found the mysql migration toolkit which will migrate the tables.But is there something which will convert the functions as well. ...

Database/SQL: How to store longitude/latitude data?

Performance question ... I have a database of houses that have geolocation data (longitude & latitude). What I want to do is find the best way to store the locational data in my MySQL (v5.0.24a) using InnoDB database-engine so that I can perform a lot of queries where I'm returning all the home records that are between x1 and x2 latitu...

compare data sets and return best match

In mysql, I am using "join tables" to assign tags to items. I would like to see which items have the most similar tags to the item being viewed. For example, let's say the item of interest has been tagged "cool", "cars" and "red". I would like to search for other items with those tags. I want to see items that have been tagged "car...

Aggregate function...select bottom n%

Hi, Here's an easy query to find the average height of boys and girls from a table of all children in a class. SELECT AVG(table1.height) FROM table1 GROUP BY table.sex Now I say I want to find the value of the bottom 20% of heights from all boys in a class. How can I do this? So if the possible values are 1,2,3,4,5,6,7,8,9,10 th...

Select more tables after FROM statement?

Hello, this is part of a security audition, so there is no way to "change" the query. Basically, what I found is a flaw that allows statement manipulation, so basically it goes like: $query = "DELETE FROM `products` WHERE `products`.`whatever` = $variable"; This is PHP, so as far as I know there is no way to execute multiple queries....

string issue of utf-8 encoding with PHP and MySQL?

This is what I tried so far,by modifying php.ini: default_charset = "utf-8" This is how MySQL is configured: mysql> show variables like '%char%'; +--------------------------+-----------------------------------------------+ | Variable_name | Value | +--------------------------+-----...

mysql_connect doesn't work on a certain host

I get this everytime I use mysql_connect() no matter what database I choose: Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'IP' (111) in filename.php on line 17 A MySQL error has occurred: Can't connect to MySQL server on 'IP' (111) The exact same file works on my personal website fine. I have trie...

Kohana ORM - How can I do this?

Having never worked with ORM before I thought I would give it a try today, I've come across my first problem that I don't know how to solve (due to my lack of understanding how ORM really works.) Say I have three tables: Languages, Codes, and a pivot table Codes_Languages. These all have properly defined relationships in the models. No...

Order By not working on MySql

Hi Order By not working on MySql the code is as follows, select * from School where School.type = 'HighSchool' order by (select locations.name from locations inner join School_locations on locations.id = School_locations.location_id where School_locations.School_id = School.id and locations.location_country = 'US'...

PHP Equivalant for INET_NTOA and INET_ATON

Are there any PHP equivalents for these two functions? I tried searching but couldn't see anything. Thanks. ...

Get next auto increment

I know this isn't so complicated but I can't remember how to do. I just need to know the next auto increment. $result = mysql_query(" SHOW TABLE STATUS LIKE Media "); $data = mysql_fetch_assoc($result); $next_increment = $data['Auto_increment']; ...but i won't work for me, what am I doing wrong? ...

mysql query problem

Hi all. This is my initial question....well I got a response but I'm still stuck. Can anyone please explain how can I achieve this in mysql: I have two fields in mysql, 'cap_commdate' with DATE TYPE and 'cap_policyterm' with INT TYPE. I want to have another field called 'cap_maturityDate' which will automatically compute the policy term...

Get percentage average

I'm unsure how to go about this either because it late, or I'm a MySQL noob (probably both to be honest). I have a table called 'poll_votes' which comprises of: ID, poll_id, answer_id, ip, time_posted What I need to do, is for each unique answer_id in a specific poll_id, calculate the percentage out of the total number of answers th...