mysql

News Portals and database heaviness

What is database design solutions for news portals with high trrafic? Could file system be a good solution? mysql > File system Thanks in advance ...

MySQL Math - Is it possible to calculate a correlation in a query?

In a MySQL (5.1) database table there is data that represents: how long a user takes to perform a task and how many items the user handled during the task. Would MySQL support correlating the data or do I need to use PHP/C# to calcuate? Where would I find a good formula to calculate correlation (it's been a long time since I last d...

Virtuemart databse connection in Joomla 1.1

Hi All, I'm modifying the Product Form to add in a field that allows a tagline for products. In the database, I've created a new field in the jos_vm_product table and added an entry in the $fields array in the ps.product.php file. In my product.product_form.php file I've used this code to insert the tagline into the database: <textare...

how do i specify connection parameters on the command line to run mysql in batch mode?

I need to be able to write a script to automatically connect mysql in batch mode so that I can run some .sql files. I tried to enter the following at the prompt: ./mysql -u root -p mypassword but I keep getting a "Enter password: " prompt. What am I doing incorrectly? Thanks. ...

MySQL DATETIME format comparison - is strtotime needed?

I've been doing something along the lines of.. $dt1 = '1000-01-01 00:00:00'; //really some val from db $dt2 = '1000-01-01 00:00:10'; //another val maybe db maybe formatted if(strtotime($dt1) > strtotime($dt2){ //do something } Is the strtotime needed? can i do a more direct comparison on the datetime formatted strings? i.e. if($dt1...

Implementing a c/c++ style union as a column in MySQL

Friends, I have a strange need and cannot think my way through the problem. The great and mighty Google is of little help due to keyword recycling (as you'll see). Can you help? What I want to do is store data of multiple types in a single column in MySQL. This is the database equivalent to a C union (and if you search for MySQL and...

How to get top 3 frequencies in MySQL?

Hello, In MySQL I have a table called "meanings" with three columns: "person" (int), "word" (byte, 16 possible values) "meaning" (byte, 26 possible values). A person assigns one or more meanings to each word: person word meaning ------------------- 1 1 4 1 2 19 1 2 7 <-- Note: second meaning for word 2 1 ...

Run multiple sql files in mysql batch

to run a single file you can run in mysql .\ filename or you outside of mysql you can run mysql < filename I have a directory of sql files so I'm trying to run them all at once by using a wildcard *.sql but it doesn't work. Any ideas? ...

What are the pros and cons of storing files in a database?

Hi, I'm writing a php application and was wondering if it's a bad idea to store complete files in the database. Files should be around 100-200kb mostly text files (txt, doc, docx and so on) or small image files. Or is it just a plain wrong idea? ...

How do you add comments to mysql queries, so they show in logs?

I wanna be able to add a little note, at the beginning of each query, so when I see it in the processlist, or "mytop", I can tell where its running. Is something like this possible? ...

MySQL: Limit output according to associated ID

So here's my situation. I have a books table and authors table. An author can have many books... In my authors page view, the user (logged in) can click an author in a tabled row and be directed to a page displaying the author's books (collected like this URI format: viewauthorbooks.php?author_id=23), very straight forward... However, i...

Generating a text file in MYSQL stored procedure

Hi, I'm new to MySQL, I am trying to create a text file using a stored procedure. I'm currently at the stage where I have a temporary table that contains all of the records that I want to output to a text file. I have the following line at the end of my SP, it works in PHPMYAdmin's query but it does not work when part of a stored pro...

"Special case" records for foreign key constraints

Let's say I have a mysql table, called foo with a foreign key option_id constrained to the option table. When I create a foo record, the user may or may not have selected an option, and 'no option' is a viable selection. What is the best way to differentiate between 'null' (i.e. the user hasn't made a selection yet) and 'no option' (i....

MySQL.. search using Fulltext or using Like? What is better?

I'm working on a search feature for my application, I want to search all articles in the database. As of now, I'm using a LIKE in my queries, but I want to add a "Related Articles" feature, sort of like what SO has in the sidebar (which I see as a problem if I use Like). What's better to use for MySQL searching, Fulltext or Like... or a...

How can I connect to MySQL on a WAMP server?

This might be ridiculously easy for you but I've been struggling with this for an hour... :( <?php $connect = mysql_connect("localhost:8080", "root", "mypassword"); echo($connect);?> This is the code that I'm trying to run - you can see that I'm using 8080 as my port number and, of course, I have html codes as well. However, it gives...

Subsonic 3, MySql, System.Collections.Generic.KeyNotFoundException

[WebMethod] public string GetAuthToken(string username, string password) { var db = new LogicDB(); //var results = from u in db.Users // where u.Username == username && u.Password == password // select u; User u = db.Select .From<User>() .W...

Can not delete row from MySQL

Howdy all, I've got a table, which won't delete a row. Specifically, when I try to delete any row with a GEO_SHAPE_ID over 150000000 it simply does not disappear from the DB. I have tried: SQLyog to erase it. DELETE FROM TABLE WHERE GEO_SHAPE_ID = 150000042 (0 rows affected). UNLOCK TABLES then 2. As far as I am aware, bigint is a ...

Random select rows via JPA

In Mysql, SELECT id FROM table ORDER BY RANDOM() LIMIT 5 this sql can select 5 random rows. How to do this via JPA Query (Hibernate as provider, Mysql database)? Thanks. ...

What HTML text encoding exactly corresponds to MySQL charset "latin1"?

What HTML text encoding exactly corresponds to MySQL charset "latin1"? ISO-8859-1, ISO-8859-2, ISO-8859-15, or another one? ...

Mysql - Get # of months and years

Is there any way to get the # of months and years since a date, using the mysql DATE column? So if I enter 1/1/2009.. I want 1 years, 3 months.. and so on. ...