mysql

Storing user data as text or ID based using lookups?

Is there any benefit to storing Days of weeks, Months, Week number, user age, etc as Lookups vs plain text entry into the database? I am creating a social website with some analytic and planning to use a Question table, Answer table and Question_Answer table to store all the data like Gender, Birth months, Age, etc so I can give each an ...

How to migrate a CSV file to Sqlite3 (or MySQL)? - Python

Hi folks, I'm using Python in order to save the data row by row... but this is extremely slow! The CSV contains 70million lines, and with my script I can just store 1thousand a second. This is what my script looks like reader = csv.reader(open('test_results.csv', 'r')) for row in reader: TestResult(type=row[0], name=row[1], res...

WordPress - can´t login with the admin account after restoring MySQL DB

I've got a Wordpress blog hosted on Linode under Cherokee web server, but the performance has been problematic the last weeks and I'd like to give a chance to Nginx. So I've made a DB backup of the current site, setup a LEMP platform, installed wordpress, and the "new" wordpress, with no articles (yet) on it works as expected. But when...

dynamic attribute transpose row to column

i have dynamic attribute table one table is main asset_id table which contain 5 fix field and another one is asset_Attribute which containt 3 col but asset_id attritbute_name attribute_value which has a facility to add dynamic col and its value asset_id table asset_id city state country Sex 1 New York ...

ActiveRecord/MySQL query to return grouped set of objects

I have a model called a Statement that belongs to a Member. Given an array of members, I want to create a query that will return the most recent statement for each of those members (preferably in one nice clean query). I thought I might be able to achieve this using group and order - something like: # @members is already in an array @...

Expense of django query

I have two tables: Actor and Images. The Images table is linked to the Actor table through a Foreign Key. I might make a query on Actor that pulls a list of all the actors with first name beginning with the letter A. Let's say I store this query result in actor_list and pass it to the template. I can get a list of all the Images thro...

Cannot combine 2 tables in CSV export

Here is the code I have came up for this problem. $link = mysql_connect($host, $user, $pass) or die("Can not connect to the host." . mysql_error()); mysql_select_db($db) or die("Can not connect to the particular database."); $result = mysql_query("SHOW COLUMNS FROM ".$table.""); $i = 0; if (mysql_num_rows($result) > 0) { while ($r...

Is that possible and safe to add ENUM value to SQL database column type ?

I have an application that works with database (PHP + MySQL). One of the columns in the database table is of type ENUM('VALUE1','VALUE2'). Is that possible to add safely VALUE3 to the ENUM without damaging the data in the table ? ...

mysql retrieve many to many rows

When I fire the following query, I get the results I require grouped by event.id: SELECT events.id AS id,events.name AS event,categories.name AS categories FROM events,categories,event_dates,event_categories WHERE events.preview = 0 AND event_dates.start_date > DATE(NOW()) AND events.i...

pick next 24 hours job

retrieve next 24 hours details from the table i read one thread, same question here link text but small diff is , my field name is jdate is the varachar, but they are used the datetime data type format, ...

mysql match against query

Hello, I am using mysql match against query in my search query like this way MATCH(film_name) AGAINST ('the vacation' IN BOOLEAN MODE). But previously i use this one film_name like '%the vacation%' So my question is that i am getting the right result now by using match and against but the problem is that when i am using like ther...

SQL (mysql) - If a given row on a given column as a certain value, don't list that column.

I have a query that retrieves some data, among those data I have some that are returned with a value like 0. I would like the query to NOT return the columns when that's the case. How can we do such a thing? Regards, MEM ...

Understanding Session Time-out (php)

I need to delete old user datas in the DB, if user session is timeout. How can I solve this problem with using PHP? ...

portable mysql for linux

hi Folks... is there a portable version of MySQL for Linux available. Thanks in advance.. Rajan ...

Browse a SQL-Dump file without importing it into a DBMS?

Is somebody aware of a tool that lets me browse MySQL-Files without having to import them into my database system? I'm looking for an easy way to inspect MySQL Backups quickly without having to import them - but still being nicely displayed, so viewing the SQL source is not really an option. Maybe there's a program that takes the SQL du...

Create date from day, month, year fields in MySQL

Hello, I am currently developing an application that displays documents and allows the members to search for these documents by a number of different parameters, one of them being date range. The problem I am having is that the database schema was not developed by myself and the creator of the database has created a 'date' table with f...

MySQL: Return fields where COUNT(*) is greater than ...

I've got the following SQL, but I only want to return rows where 'hits' are greater than 10. SELECT clicks.affiliate, COUNT(*) AS hits, affiliates.title, affiliates.url FROM clicks INNER JOIN affiliates ON affiliates.id = clicks.affiliate GROUP BY clicks.affiliate Thanks. ...

insert php array into mysql

I have an array $product_array, and when I use print_r($product_array);. The array shows like this Array ( [0] => Array ( [ID] => P00100 [NAME] => Edina [PRICE] => $20.00 ) [1] => Array ( [ID] => P00101 [NAME] => Richfield [PRICE] => $21.00 ) [2] =...

MySQL: How to calculate weeks out from a specific date?

I need to calculate the weeks out from a date in my MySQL select statement. There is a date column in one of the tables, and I need to calculate how many weeks away the date is. SELECT EventDate, (calculation) AS WeeksOut FROM Events; Example: 6 days away, weeks out = 0 7 days away, weeks out = 1 13 days away, weeks out = 1 14 days ...

MySQL Using Subquery To Get Table Name?

I'm trying to select some data from a MySQL database. I have a table containing business details, and a seperate one containing a list of trades. As we have multiple trades business_details id | business_name | trade_id | package_id 1 | Happy News | 12 | 1 This is the main table, contains the business name, the trade ID...