mysql

Fluent Nhibernate and MySql, problems with dialect

I have question about fluent nhibernate and mysql. I'm doing this: Fluently.Configure() .Database(MySQLConfiguration.Standard.ShowSql()) .Mappings(m => m.FluentMappings .AddFromAssemblyOf<ShopperMapping>()) .BuildConfiguration();SchemaExport exp = new SchemaExport(cfg); exp.Execute(true, false, false, true);...

MySql Select, MANY FIELDS, how best to display in terminal?

I'm using Putty (Command-line) and running a mysql> SELECT * FROM sometable; The 'sometable' has many fields and this results in many columns trying to be displayed in the terminal. The fields wrap onto the next line so it is very hard to line up Column titles with Field values. What solutions are there for viewing such data in term...

Reconstruction User based Modular Website

I am developing a website in Ruby on Rails, MySQL, and Javascript. The website is modular, meaning that a user can customize their homepage and drag and drop one module to another area where it will live. there are three columns where the module can be dropped. (Think iGoogle or Netvibes) What is the best way to store this data, so th...

C# transfer data from mssql to mysql

I need to transfer data from sql server 2008 express to MySql. The data is around 2.000.000 records in total and 4 tables. In C# I can insert these records very quickly with the Table-Valued parameter. (Around 50 seconds). Within a transaction. Now I was wondering if there is something similar for MySql that I can do in C#. ...

Select all records don't meet certain conditions in a joined table

Let's say we have two tables here , posts and comments, the relations is one to many, there has a field call comment_date in the comments table. Now I am struggle to get the expected results as follow: All the posts have no comments after a certain date, can I done this by a SQL statement? ...

what characterset to use when i create my database

So I am doing a lot of php tutorials and I always wonder when creating my different DBs... What charset should I be using? Depending on what DB interface I use it seems to default to different options. So what is the most common one I should use for basic programing... Or can someone point me to a good guide to charsets in MySql ...

Adding 2 drop lists to associated table

Hi, I am having an issue trying to add the records using 2 drop lists. I have a table called Urls which holds the details of url. I have a table called category populates a drop list, I have another table called publishers which populates another drop list. $query = 'INSERT INTO url_associations (url_id, url_category_id, approved,...

Getting SQL to use the correct index

I have a table with two indexes, one of which is the faster covering index for a certain query. However, mySQL (5.1) is not choosing the correct index. I have looked at the explain for this query and done some speed tests and it makes a big difference if you force the key. Is there any way of examining how it picks the index and what cr...

Mysql Create Database with special characters in the name

Hi All I want to create a database which name will have special characters in it. for example, (., - , _, @, #, $, %, &, *) can anyone provide any output on this? ...

when will select statement without for update causing lock?

I'm using MySQL, I sometimes saw a select statement whose status is 'locked' by running 'show processlist' but after testing it on local,I can't reproduce the 'locked' status again. ...

MySQL: How to Combine multiple SELECT queries, using different WHERE criteria on the same table?

Hello Stack Overflow, I have been trying many different ways to solve this problem from this forum and from many others. I can't seem to find a solution to this problem or any documentation that will give me a straight answer. I wondered if you could have a look at it for me. Thanks THE PROBLEM: I've got a database with the followin...

Simple MySQL Table Running Slow Queries

I have a very simple table with two columns, but has 4.5M rows. CREATE TABLE `content_link` ( `category_id` mediumint(8) unsigned NOT NULL, `content_id` int(10) unsigned NOT NULL, PRIMARY KEY (`content_id`,`category_id`), KEY `content_id` (`content_id`,`category_id`) ) ENGINE=MyISAM; When I run a simple query like: SELECT ...

mysql_query doesn't work in IIS - alternative?

I'm using PHP in a Windows/IIS environment and found this db related code not to work: $result = mysql_query("SELECT * FROM users WHERE id=12); So is there an alternative to mysql_query? ...

PostgreSQL vs. mySQL

I tried to Google this but it seems like most of the answers are terribly outdated. So, the question is simple: why would I choose one over the other? What are the benefits of each, and what drawbacks do they have? EDIT: Please close this. Apologies, I didn't see the other duplicates when I did a search earlier. ...

Find all MySQL Stored Procedure calls?

For a given MySQL DB that I use and modify occasionally I had to recently make some changes to some tables and stored procedures. There are places in this DB where procedures make calls to other procedures. I found the task of hunting down everywhere that I needed to modify the parameters to these modified procedures a hassle and reso...

Check If Username Exists

Whats the best way to check if a username exists in a MySQL table? ...

[MySQL] Adjusting for timezones and DST

On my website, users can set preferences for their current timezone. I have a bunch of datetimes in my database, but I want to show each time appropriately, given A) what timezone they are in, and B) whether or not Daylight Savings is in effect. What is the best way to go about this? ...

Why would two mysql files (same table, same contents) be different in size?

I took an existing MySQL database, and set up a copy on a new host. The file size for some tables on the new host are 1-3% smaller than their counterpart files on the old host. I am curious why that is. My guess is, the old host's files have grown over time, and within the b-tree structure for that file, there is more fragmentation. ...

Suggestions for insert with Foreign key constraint in mysql

I have a table containing 2 entries. Something like CREATE TABLE `db`.`main` ( `id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ); The id for these 2 entries are automatically generated primary keys. I have another table with a rule linking CREATE TABLE `db`.`day` ( `main_id` int(10) unsigned NOT NULL, `day` tinyi...

Optimizing an embedded SELECT query in mySQL

Ok, here's a query that I am running right now on a table that has 45,000 records and is 65MB in size... and is just about to get bigger and bigger (so I gotta think of the future performance as well here): SELECT count(payment_id) as signup_count, sum(amount) as signup_amount FROM payments p WHERE tm_completed BETWEEN '2009-05-01' AND ...