mysql

Django migrations--is it possible to use South in the middle of the project?

I already started a project, and the models are all synced and everything. ...

deadlocks in the innodb status

Mysql sever has suddenly become very slow. There are no queries in the slow query log but the innodb status shows something like the following. Does it mean that it is due to innodb deadlock? if Yes, what is the way out? *************************** 1. row *************************** Status: ===================================== 100315 ...

mysql: Average over multiple columns in one row, ignoring nulls

I have a large table (of sites) with several numeric columns - say a through f. (These are site rankings from different organizations, like alexa, google, quantcast, etc. Each has a different range and format; they're straight dumps from the outside DBs.) For many of the records, one or more of these columns is null, because the outside...

In Django, what is a one-to-one relationship?

I've always been using ForeignKeys. ...

Local use of MySQL database

Hi all, Is it possible to use MySQL local? I mean NOT at a server. I read a lot about MySQL on a webserver with PHP, Joomla etc. I want to program a piece of software and use a database local to store results. Can I use MySQL for that? If so, is ther anyware on the net a good tutorial how to do that? ...

Is there a tool like phpMyAdmin which can be configured to access just a single database?

Is there a tool like phpMyAdmin which can be configured to access only a single MySQL database in a server? I cannot use phpMyAdmin because it allows access to all databases. A view that can allow a user to create/delete/insert/update tables should do. I remember using a software similar to this but dont remember what it was. It would a...

Postgresql slave for Mysql Master. Possible ?

Hi, I need to make some tests for a potential migration from Mysql to PostgreSql. It will be easier to test if it is possible to use Postgre as slave for my MySQL master. Is it possible ? Thanks in advance ...

SQL SELECT Join?

I have a MySql DB. There is a table with products and orders with the structure: Products: product_id, name, manufacturers_id Orders: orders_id, product_id, quantity Now I want to get all orders (show only products where product manufacturers_id=1). I tried: SELECT orders.orders_id, orders.product_id FROM products, orders WHERE p...

display unsigned zerofill autoincrement value without leading zero

my primay key is user_id which is auto incremant UNSIGNED ZERO FILL, i want to display user_id on a page without leading Zero( means 1 instead of 0000000001 ).. how can we do that in php or in mysql one more question... if i delete last record( let user_id=21) wwhich have highest id of that table then can we adjust auto increment valu...

How would I write this query in GeoDjango? (It's a library for geographic calculations in Django)

Right now I'm using raw SQL to find people within 500 meters of the current user. cursor.execute("SELECT user_id FROM myapp_location WHERE\ GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < %s"\ ,(user_utm_easting, user_utm_northing, 500)); How would I do this in GeoDjango? It...

Streaming large result sets with MySQL

I'm developing a spring application that uses large MySQL tables. When loading large tables, I get an OutOfMemoryException, since the driver tries to load the entire table into application memory. I tried using statement.setFetchSize(Integer.MIN_VALUE); but then every ResultSet I open hangs on close(); looking online I found that tha...

Delete record in MySQL with php targeting auto_incremented int?

Why doesnt this delete work to delete the whole record: $query = 'DELETE FROM tblEvents WHERE index = $_GET["id"]'; $result = mysql_query($query, $db) or die(mysql_error($db)); Where index is variable of type int, auto_incremented in MySQL? ...

Database design for heavy timed data logging

Hi, I have an application where I receive each data 40.000 rows. I have 5 million rows to handle (500 Mb MySQL 5.0 database). Actually, thoses rows are stored in the same table => slow to update, hard to backup, ... Which king of scheme is used in such application to allow long term accessibility to the datas without problems with too...

How to get values from SQL query made by php?

So I made a query like this global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); in my DB there are filds ID, UID, SID, TIME (all INT type exept time) So I am triing to print query relult into form <form> <select class=...

PreparedStatement alternative within JPA ?

Dear all, I am new to JPA, I used to used prepared statement in JDBC. Is there alternative to be used within JPA ? as there is a query which I call frequently see this for info about prepared statment http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html thanks in advance,,, ...

Beginners PHP / mySQL question

I'm brand new to PHP & MySQL, and one function I'm creating needs to access a large table or database. I've created the database and it's currently in a MySQL table, which I'm accessing with no problem. The table is 11,000 rows in length, with 8 columns (all text less than 8 characters long) - it's static, and will never change. Without ...

Take Current Snapshot of DB and send it to FTP in same PHP Scripts: Advice Needed

Not sure if I can do it this way. I want to get current snapshot of the database and send it via FTP Server, both of this functionality should be implemented in PHP scripts. Here are the steps I am thinking on right now. In my php scripts(basically am extending an PDO into my Dao class and then preparing the query), $qry = SELECT *...

MySQL Wrong Restore Data Recovery

I'm almost certain about the answer, but the situation is so critical that I have to ask this question even though I'm %99 sure about the answer. Someone in our office made a backup of a MySQL database and he restored it on a wrong destination database overwriting everything on that destination (The schema of both databases were the sam...

MySQL query to find customers who have made the most orders

tbl_customer.id is the customer's id tbl_order.customer_id a query that will select all customers with say 4 or more records in tbl_order ...

Views performance in MySQL for denormalization

I am currently writing my truly first PHP Application and i would like to know how to project/design/implement MySQL Views properly; In my particular case User data is spread across several tables (as a consequence of Database Normalization) and i was thinking to use a View to group data into one large table: CREATE VIEW `Users_Merged`...