mysql

ASP.NET MVC open source application. MySQL or SQL Server?

Hi, I have around 4 years experience of ASP.NET & SQL Server (only web forms). I have a little knowledge of Ruby on Rails and have developed one very small 2-3 pages application in ASP.NET MVC in my job. Now I and one of my friend ( same experience like me) are willing to gain more experience of ASP.NET MVC. For that purpose we have thou...

MySQL: how do I drop all empty tables from a database?

How do I drop all empty tables from a MySQL database leaving only the tables that have at least 1 record? ...

Is it possible to rename a MySQL table name already in the database?

Is it possible to rename a MySQL table? If so, how? ...

Mysql query to return server load average

Does anyone know of a MySQL query that returns the server's current load average? ...

MySQL String match percentage

In MySQL, how can I compare two strings and get matching percentage. Something like this: compare(needle, haystack) = percentage compare("foo", "food") = 0.75 compare("foo", "foobar") = 0.5 compare("foo", "foofoo") = 1.0 compare("foo", "fo") = 0.0 I hope you get the idea :) ...

Compare MySQL "Time" Field with String in PHP

Hello, I have a specific row in my database, with the following information: data: user_id start_time end_time 405 12:00:00 14:00:00 I have the following SELECT statement: SELECT * FROM data INNER join users on users.user_id = data.user_id WHERE NOT EXIST...

MySQL 2 level MENU Query

I'm trying to do a MySQL request to retreive a 2 level menu (parent and children)... There's only 1 table, of course : idCategory | Title | idCategoryParent | DisplayOrder 1 | cat1 | NULL | 1 2 | sub-cat1 | 1 | 1 3 | sub-cat2 | 1 | 2 4 | cat2 | NUL...

MySQL full text search for words with three or less letters

I'm trying to get my full text search (in boolean mode) to retrieve words with three letters or less. Currently, if I search for something like "NBA", I don't get any results. However, if I append the wild card operator "*" to the search term, I get results. I also read that you could remove the three word limit in my.ini, but I'm won...

Create a mysql primary key without a clustered index?

I'm a SQL Server guy experimenting with MySQL for a large upcoming project (due to licensing) and I'm not finding much information in the way of creating a primary key without a clustered index. All the documentation I've read says on 5.1 says that a primary key is automatically given a clustered index. Since I'm using a binary(16) for t...

Is it better in MySQL to have 1 large table or 2 smaller tables?

Here is my situation: I have about 50 different fields of data that I need to store for 1 record (none are the same or repeating). About 15 of the fields are ones that I commonly need to use in queries, while the remainder are used on occasion (~40% of the queries). Should I setup 2 tables, one containing the common fields and the other...

Synchronize Core Data with SQL or MySQL Via SQLite

I am trying to build an iPhone application using core data's built in table management. I want synchronize the data with an MSSQL or MySQL database. Core data is compatible with SQLite so I thought it might work as a bridge. Can anyone think of how one might achieve this functionality? ...

Inserting php array data into mysql isn't working

Hello I have an array $name[] that I am trying to insert into the second field of my table but it's not working (table remains completely blank). I cannot find the error in my code what am I doing wrong? $username="us"; $password="pw"; $database="db"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "err...

mysql query with select - where - in - join

Which is the better way of retrieving multiple rows? select * from order_details where order_id in (1,2,3, ... .... ) ...or: select * from order_details INNER JOIN orders on orders.id = order_details.order_id INNER JOIN customers on customers.id = orders.customer_id where customers.id = 3 ...

MySQL Select Statement, WHERE 'IN' Clause

Hello, I currently have the following row in my table: course_data: user_id days <-- This is a varchar column. 405 1,3,5 and I am trying to implement the following SELECT statement: SELECT usrID, usrFirst, usrLast, usrEmail FROM tblUsers WHERE usrID NOT IN ( ...

How would I retrieve parent categories in a mysql query?

My goal is to achieve a list of parent categories from a nested category the easiest way. Say if I had a site that sold a variety of different products, one of which is a quad core pentium. A feature that I'd be able to display on my webpage is as follows: Electronics > Computers > CPU's > Intel > Intel Quad Core The category table tha...

SQL query doesn't work when using UNION?

Here is the snapshot of the query that doesn't work since I added the Union. SELECT fin05_usager.idUsager, (SELECT sum(nombreReputation) as nombreReputation FROM (SELECT SUM(nombreReputationGagner) as nombreReputation FROM fin05_usager_reputation WHERE fin05_usager_reputation.idUsager =...

Generating a massive 150M-row MySQL table

I have a C program that mines a huge data source (20GB of raw text) and generates loads of INSERTs to execute on simple blank table (4 integer columns with 1 primary key). Setup as a MEMORY table, the entire task completes in 8 hours. After finishing, about 150 million rows exist in the table. Eight hours is a completely-decent number fo...

Update to php5.3 breaks connecting to mysql db

I just updated php to 5.3 and can no longer connect to my remote mysql server. I get the following errors: mysqli_connect(): OK packet 6 bytes shorter than expected mysqli_connect(): (HY000/2000): mysqlnd cannot connect to MySQL 4.1+ using old authentication It seems this has to do with the new mysqlnd driver. Is there a way to force ...

PDO binding values for MySQL IN statement

Hi, I have an issue with PDO that I'd really like to get an answer for after being plagued by it for quite some time. Take this example: I am binding an array of ID's to a PDO statement for use in a MySQL IN statement. The array would be say: $values = array(1,2,3,4,5,6,7,8); The database-safe variable would be $products = implode('...

MySQL Query Browser - using variables

I'm used to MSSQL's Query Analyzer. Needing to convert some SP's for a hobby project, I'm having trouble making the transition to the mysql query browser, particularly when it comes to using variables. I'm essentially trying to simulate a procedure before it's a procedure. So in Query Analyzer i'd write something like this... delca...