Forum: MySQL Nov 9th, 2009 |
| Replies: 16 Views: 1,145 Please note tho, that the performance gain from using this method is usually very minor when compared to other optimization methods, such as properly indexing the fields.
A well placed index can... |
Forum: MySQL Nov 9th, 2009 |
| Replies: 16 Views: 1,145 Not really, no. The field itself isn't faster.
What makes it faster is that it will always have the same size for every row. If you create a CHAR(50)column and only put 20 characters into one of... |
Forum: MySQL Nov 8th, 2009 |
| Replies: 16 Views: 1,145 Hey.
If you have a table with a VARCHAR field, you can often improve search performance on it by changing the field to the CHAR type. It has a static length, which allows MySQL to calculate a... |
Forum: MySQL Nov 8th, 2009 |
| Replies: 6 Views: 587 UTF-8 (utf8_general_ci) should work fine for that. Even for the Chinese characters.
I've created blog software in the past, using UTF-8, that I used to post content in multiple languages,... |
Forum: MySQL Nov 3rd, 2009 |
| Replies: 2 Views: 517 Hey.
How about something like:
// Create a list object for the conditions, and the query string.
List conditions = new List();
String query = "SELECT * FROM tbooks";
// Add each condition... |
Forum: MySQL Nov 3rd, 2009 |
| Replies: 1 Views: 453 Hey.
I don't know of a MySQL statement that is capable of fetching those values in such a way that it can be return as a table, and I am unable to find one in the manual. (Although, it may well... |
Forum: MySQL Nov 1st, 2009 |
| Replies: 1 Views: 428 Hey.
You can see how MySQL procedures look like in the manual (http://dev.mysql.com/doc/refman/5.1/en/stored-programs-defining.html).
In your case it would look something like this:
DROP... |
Forum: MySQL Oct 31st, 2009 |
| Replies: 5 Views: 1,096 Ok, so I almost have this figured out.
SELECT f.`file_id`, f.`name`
FROM `file` AS f
WHERE f.`file_id` NOT IN(
SELECT fi.`file_id`
FROM `file` AS fi
INNER JOIN `file_keyword`... |
Forum: MySQL Oct 31st, 2009 |
| Replies: 5 Views: 1,096 You could also try using joins:
SELECT f.FileID, f.Name
FROM `File` AS f
INNER JOIN `File_Keyword` AS fk1
ON f.`FileID` = fk1.`FileID`
AND fk1.`Keyword` LIKE '%key1%'
INNER JOIN... |
Forum: MySQL Oct 17th, 2009 |
| Replies: 1 Views: 497 Hey.
You could just create a separate table for each filter and update them periodically, either using the Event Scheduler (http://dev.mysql.com/doc/refman/5.1/en/events.html), or just by creating... |
Forum: MySQL Jun 19th, 2009 |
| Replies: 7 Views: 1,100 The ROW_COUNTfunction is the mysql_affected_rowsequivalent in MySQL.
Keep in mind that the query browser is just a development tool. It doesn't execute queries the same way a PHP or JSP script... |
Forum: MySQL Jun 19th, 2009 |
| Replies: 7 Views: 1,100 Ok.
It seems query browser executes queries on separate connections, or something like that, so when you execute a INSERT/UPDATE/DELETEand then a SELECT ROW_COUNT(); query, the data from the... |
Forum: MySQL Jun 18th, 2009 |
| Replies: 7 Views: 1,100 Hi.
The ROW_COUNT (http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_row-count) function will return the number of rows in a previous INSERT, UPDATE or DELETE statement. |
Forum: MySQL Jun 18th, 2009 |
| Replies: 2 Views: 1,047 Hi.
You could try the IF function:
SELECT
IF(SUM(number) IS NOT NULL, SUM(number), 0) AS `Sum`
FROM myTable; |
Forum: MySQL Jun 18th, 2009 |
| Replies: 1 Views: 582 Hi.
You don't actually have to check if it exists, just use the IF EXISTSclause:
DROP TABLE IF EXISTS `myTable`;
CREATE TABLE `myTable`( ... ); |
Forum: MySQL Jun 17th, 2009 |
| Replies: 9 Views: 3,322 Then you probably have no use for them.
If your tables are only storing regular numbers, you will probably just wan to use the INT types. (Or DECIMAL, if they have fractions) |
Forum: MySQL Jun 16th, 2009 |
| Replies: 9 Views: 3,322 Binary... That has a lot of meanings. (See Wikipedia (http://en.wikipedia.org/wiki/Binary).)
In this context, however, you are probably talking about binary numbers... |
Forum: MySQL Jun 16th, 2009 |
| Replies: 3 Views: 1,552 Ok. I'm glad you found a solution ;-) |
Forum: MySQL Jun 15th, 2009 |
| Replies: 9 Views: 3,322 Simply put... unsigned integers can be twice as high as signed integers, but unsigned integers can not have negative values.
Thus, a normal signed integer has the range:
-2147483648 to 2147483647... |
Forum: MySQL Jun 12th, 2009 |
| Replies: 8 Views: 621 Are you getting an error when you include that?
Your code looks OK, except that you commented out the line where you select a database. If the database info is correct, that should connect and put... |
Forum: MySQL Jun 12th, 2009 |
| Replies: 3 Views: 1,552 Hi.
When you say that it has two primary keys, do you mean they are a joint primary key?
Because you can only have a single PK, so to use more then one row as the PK, you have to make a composite... |
Forum: MySQL Jun 12th, 2009 |
| Replies: 8 Views: 621 Ok. Not exactly sure what this has to do with what I said, but I'll bite.
If you prefer that syntax, I'm fine with that.
I doubt there is a notable performance difference, so the difference is... |
Forum: MySQL Jun 11th, 2009 |
| Replies: 8 Views: 621 I was going to be all descriptive, but the words didn't come to me.
So I just wrote you an example:
<?php
// Isset actually takes an unlimited amount of parameters.
if(isset($_POST['submit'],... |
Forum: MySQL Jun 11th, 2009 |
| Replies: 9 Views: 3,322 Each Integer type is stored using a certain amount of bytes.
(See a list here (http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html))
A typical INT uses 4 bytes, so it can store the... |
Forum: MySQL Jun 11th, 2009 |
| Replies: 5 Views: 598 You could also have them bothlisted alpabetically.
SELECT name, num FROM tablename ORDER BY name, num
That might give you:
+------+-----+
| name | num |
+------+-----+
| Abc | 1 |
| Abc ... |