mysql

Select a record that has a duplicate

I'd like to select all records from a table (names) where lastname is not unique. Preferrably I would like to delete all records that are duplicates. How would this be done? Assume that I don't want to rerun one query multiple times until it quits. ...

Export unicode data from mysql

Hi Folks, I have some data in one of my mysql table stored as utf8. The data is some japanese text. I need to export it to excel. Could you tell how to do it? Exporting by SELECT ... INTO OUTFILE returns some plain text file. I'm not sure how to read it back in excel so that japanese character would show properly Thanks Nayn ...

Mysql - Help me change this single complex query to use temporary tables

About the system: - There are tutors who create classes and packs - A tags based search approach is being followed.Tag relations are created when new tutors register and when tutors create packs (this makes tutors and packs searcheable). For details please check the section How tags work in this system? below. Following is the concerned...

How to return null value if the query has no corresponding value?

Hi i've a query select c.name as companyname, u.name,u.email,u.role,a.date from useraccount u, company c, audittrial a where u.status='active' and u.companyid=c.id and ( u.companyid=a.companyID and a.activity like 'User activated%' and a.email=u.email ) order by u.companyid desc li...

Drive space hungry NoSQL's databases

I've tested NoSQL databases like CouchDB, MongoDB and Cassandra and observed tendence to absorbing very large amount of drive space relative to inserted key-value pairs. When comparing CouchDB and MySQL schemaless databases CouchDB is consuming much more drive space than MySQL. I know about that key-value DBs by default are versioning ...

MySQL stored procedure debugging

Hello, do you have any tips for some GUI applications (free) that are capable of debugging MySQL stored procedures? I tried devArt dbForge MySQL Studio which worked just fine, but it's not free. Thanks for any tips. ...

What sort of schema can I use to accommodate manual date based data entries?

I have an admin where users from multiple properties can enter in monthly statistics for twitter/facebook followers. We do not have access to the real data/db so this is why a manual entry. The form looks like this: Type ( radio, select **one** only ): - Twitter - Facebook Followers/Fans ( textfield ): Property (dropdown): Hotel A, ...

mySQL: How many rows in a table before performance is affected?

Hi everybody, Is there a "known limit" for columns & rows in a mySQL table that when passed, it can be safe to say that performance is severely affected? I've think that I had heard that there is a "golden number" that you really dont want to exceed in either columns or rows in a table. - Or is it all about the size of the index and av...

php/mySQL error: mysql_num_rows(): supplied argument is not a valid MySQL result

I'm trying to INSERT INTO a mySQL database and I'm getting this error on: if (mysql_num_rows($login) == 1){ Here is the php, The php does add the user to the database. I can't figure it out. <? session_start(); require("config.php"); $u = $_GET['username']; $pw = $_GET['password']; $pwh = $_GET['passwordhint']; $em = $_GET['email']...

mysql import/export

I am trying to create an automatic process which will synchronize the databases of two servers. One site is live, and I need the testing environment to sync up with the live site every so often (I am thinking a cron job for that). How can I implement this? ...

PHP MySQLi isn't letting me alter a table (adding a new column)

Well thats pretty much it. This is my query: $query = 'ALTER TABLE permissions ADD '.$name.' INT NOT NULL DEFAULT \'0\''; Where $name is already checked to exist with only lower case alpha letters, and not more than 20 length. Im just starting this out with very simple names. The next 4 lines of code after that one are: if($stmt = ...

storing numbers as varchar

Is it ok to store numbers as varchar? What's the difference between int 123456789012 and varchar 123456789012 ? ...

mysql too many connections

Hi All, Too many connections - End of inner exception stack trace - I get this exception for an application running mysql as backend and .net. Any thoughts on the source of this, our DB guy tells that max connections has not reached, so this error is not because of max connection? Thanks. ...

restrict duplicate rows in specific columns in mysql

I have a query like this : select testset, count(distinct results.TestCase) as runs, Sum(case when Verdict = "PASS" then 1 else 0 end) as pass, Sum(case when Verdict <> "PASS" then 1 else 0 end) as fails, Sum(case when latest_issue <> "NULL" then 1 else 0 end) as issues, Sum(case when latest_issue <> "NULL" and issue_type = "TC" then 1 ...

help with stored procedure

i am looking at this site: http://cloudexchange.cloudapp.net/stackoverflow/s/84/rising-stars-top-50-users-ordered-on-rep-per-day set nocount on DECLARE @endDate date SELECT @endDate = max(CreationDate) from Posts set nocount off SELECT TOP 50 Id AS [User Link], Reputation, Days, Reputation/Days AS RepPerDays FROM ( SELEC...

Get current updated column name to use in a trigger

Is there a way to actually get the column name that was updated in order to use it in a trigger? Basically I'm trying to have an audit trail whenever a user inserts or updates a table (in this case it has to do with a Contact table) CREATE TRIGGER `after_update_contact` AFTER UPDATE ON `contact` FOR EACH ROW BEGIN INSER...

Do MySQL Locked Tables affect related Views?

So after reading http://stackoverflow.com/questions/1415602/performance-in-pdo-php-mysql-transaction-versus-direct-execution in regards to performance issues I was thinking about I did some research on locking tables in MySQL. On http://dev.mysql.com/doc/refman/5.0/en/table-locking.html Table locking enables many sessions to read...

Upload a file to import data to mysql using phpmyadmin

Hello, I want to upload .cvs a file above 2048kb, how do I alter this value, in PHPMYADMIN. Its a WAMP Thanks Jean ...

Mysql select - improve performances

Hey, I am working on an e-shop which sells products only via loans. I display 10 products per page in any category, each product has 3 different price tags - 3 different loan types. Everything went pretty well during testing time, query execution time was perfect, but today when transfered the changes to the production server, the site ...

How to store non-english characters?

Non-english characters are messed up in a text column. Arabic text looks like this: ! نـجـم سـهـيـل How to store non-english characters correctly? ...