mysql

Can MySql rollback a sql transaction over multiple tables?

I have searched the MySql documentation and found nothing. I have tried this ... the Rollback doesn't seem to cancel the inserts made in table1 and table2 Start Transaction; INSERT INTO Table1(field1,field2) VALUES (value1, value2); INSERT INTO Table2(field3,field4) VALUES (value3, value4); INSERT INTO Table3(field5,field6) VALUES (...

DB Schema For Chats?

i need to store chat conversations in a database schema. the way i would use this database is i would post chats on a website. each chat would not be more than about 20 responses. can someone please suggest a schema for this? ...

Large MyISAM table slow even for non-concurrent inserts/updates

I have a MyISAM table with ~50'000'000 records (tasks for web crawler): CREATE TABLE `tasks2` ( `id` int(11) NOT NULL auto_increment, `url` varchar(760) character set latin1 NOT NULL, `state` varchar(10) collate utf8_bin default NULL, `links_depth` int(11) NOT NULL, `sites_depth` int(11) NOT NULL, `error_text` te...

mysql count help

I am trying to count the number of rows in a table that have an area, how can I achieve this, I currently have this query written, SELECT DISTINCT area FROM cv WHERE status = 'SHOW' AND is_complete = 'TRUE' ORDER BY area ASC This query currently returns, area ------------------ West Yorkshire Lanchashire What I am w...

How to use join to fetch related data from many tables?

table name: holi id country hdate (holiday date) description link and the above table is split into many tables to reduce redundancy as table countries id name table holidays id holiday table holiday_countries id holiday_id (fk of id from holidays) country_id (fk of id from countries) link SO now i need to ...

What files needed for JDBC connection to MySQL?

I get the following error when attempting to connect to the MySQL database on my employer's local server: Unable to load database driver Details : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver BUILD SUCCESSFUL (total time: 0 seconds) I think it's pretty clear that this is because I don't have my files set up properly....

how to query to display column names except an array list

hey guys im looking for to show columns of a table except some. forexample my table name mobile_table has columns like : sony nokia apple LG Sumsung ...and i need to show these columns except Sumsung ,LG $exceptions_arr = "LG,Sumsung" i know how to show column names of a table but not to apply exeption array filter ! $qu...

Help setting up sphinx

ok I downloaded sphinx-0.9.9.tar.gz to my desktop I extracted to a folder called sphinx on my desktop. I run: cd ~/Desktop/sphinx ./configure --prefix=/usr/local/sphinx --with-mysql alot of stuff happens. Then I run this line make I get this error: make: * No targets specified and no makefile found. Stop. I...

Which is quicker when indexed. INT (10) or Timestamp in MySQL

I was just wondering which field type would be the best solution for storing a timestamp in a MySQL database. Currently I store timestamps in an INT (10) field and insert the time by doing UNIX_TIMESTAMP(). If I was to use a timestamp field would it be slower or quicker when indexed? I know both fields use 4 bytes. ...

Cumulative sum over days

I have a MySQL table like the following: date count 2010-01-01 5 2010-01-02 6 2010-01-03 7 How can I accumulate the sum of each day to the next one? So the result is like: date acum per day 2010-01-01 5 2010-01-02 11 2010-01-03 18 I think i need some kind of for(each date)... but no clue. Just the fin...

programming add-ons, accessing backend of HRMS

HR manager asked me to pick a good HRMS system for them to use i have zero experience with HR systems. one of the factors that i would look at is how "open" it is and whether i can connect to it and run select statements on it, and whether i can program add-ons. can you recommend to me some HR systems that allow you to do these? the...

Inserting multiple rows with loop

Code: for($i = 1; $i <= $arr['var']; $i++) { if($i == $arr['var']): $insert .= '('.$n_id.', 12)'; else: $insert .= '('.$n_id.', 12),'; endif; } $uz = mysql_query("INSERT INTO `cars` (n_id, auto_id) VALUES '$insert'") or die(mysql_error()); Why it gives me a ...

PHP/MySQL Pagination

Hey, I am new to php and sql, and i have one tiny question about how to realize sql query , that can: Take for example 5 entries from DB, insert them on 1st page (1-5) Than take next 5 entries from same DB and insert them on another page (5-10) and so on :) Thank you ) ...

Rails scaffolding from scratch has its drawbacks..

1st Question: I'm trying to make the create method work, but it appears that my form is sending data innapropriately to my DB. This is the server.log : Processing Admin::AdminWysisController#create (for ::1 at 2010-06-22 13:43:58) [POST] Parameters: {"commit"=>"save", "action"=>"create", "authenticity_token"=>"P8pW7GnSNr7RZcxFcejpfsu9Y...

Looking for data set to text FULLTEXT style searches on

Hi, I am looking for a corups of text to run some trial fulltext style data searches across. Either something I can download, or a system that generates it. Something a bit more random would be better e.g. 1,000,000 wikipedia articles in a format easy to insert into a 2 column database (id, text). Any ideas or suggestions? ...

How to display a students total grade points correctly using PHP & MySQL?

So far I think I'm doing it right but I cant seem to display the grade_points correctly here is what I'm display below. How can I fix it so that my code will display the grade_points correctly? OUTPUT DATA Here is my current output: user_id Array ( [1] => 1 [3] => 2 ) rank Array ( [0] => 1 [1] => 3 ) grade_points Array ( [0] => [1] ...

How do I keep one column consistently updated?

Hello, another newbie mysql question I have a faculty table, and each faculty has a certain number of students under him/her. So there is a 'current' column, which is the number of students currently under them. However, I don't want to ++ and -- everytime I switch a student to another faculty. Is there a way to keep the column update...

How to run django's test database only in memory?

My django unit tests take a long time to run, so I'm looking for ways to speed that up. I'm considering installing an SSD, but I know that has its downsides too. Of course there are things I could do with my code, but I'm looking for a structural fix. Even running a single test is slow since the database needs to be rebuilt / south mi...

MYSQL - Move data from one table to a related one?

I have two tables, structured like so: table A: A_ID varchar(32) PRIMARY KEY field1 varchar(255) field2 varchar(255) B_ID varchar(32) table B: B_ID varchar(32) PRIMARY KEY field1 varchar(255) field2 varchar(255) A contains a foreign key to table B (note that 1 B could have more than 1 A). I'd like to...

Shell script to merge two list and remove duplicates

I have the following code: get_list_a() { $MYSQL -B -u $USER --passwword="$PW" $DB1 <<EOF select name, value from mytable_a EOF } get_list_b() { $MYSQL -B -u $USER --passwword="$PW" $DB2 <<EOF select name, value from mytable_b EOF } get_list_a >$test.txt Now I need to combine a and b first and remove all dups(key is name, ...