mysql

Suppress Comment in SQL Generation MySQL WorkBench

MySQL workbench can export a MYSQL data model to SQL create table script. But can I choose to suppress comments when doing the export? If yes, how? ...

Export MySQL Workbench data model directly to Schema YML in Propel/ Symfony

Is there any plugin that directly exports MYSQL Workbench data model directly to YML for Propel consumption? ...

Perform UPDATE and setting a user variable in one single query.

Everyone familiar with php's mysql_query command, knows that it doesn't allow us to perform more than one query (separated by the ; delimiter) in one call... My problem is that I wan't to be able to define a user variable in my UPDATE query so that I increment it for each row (kinda like auto increment). It should look like something as...

How can i get the value of a pkey for a record just inserted (autoincrement)?

I'm subsequently inserting a single record in two tables. With the first insert i put the record in the main table, where the primary key value gets generated. Now i need to put some fields of this record in another table including the key value of the main table. How do i do this? ...

counting the number of rows in a table using mysql

whats the syntax in getting the total number of rows in a particular table in an mysql database? ...

Object-oriented-like structures in relational databases

Folks, For the n-th time in a row, i'm hitting the same old problem again. It's about "how do I map OOP structures to database tables in a painless way." Here's a scenario: I have several types of "actors" in my system - workers, employers, contacts. They have certain pieces of functionality in common; other pieces are vastly differen...

Why not use the creation time of a record as a primary key?

I have a table, which have an auto-incremented PK and creation_date field, which is the unix timestamp. I am wondering why not lose the auto-incremented field and use the creation date field as the PK, as it is unique (I am using 1/1000 of a second accuracy). For: I am killing an indexed row. Against: there is a slight (very very slig...

Webcasting/Broadcasting using VB.NET, MYSQL and ASP.NET

Hi,. I am currently working on my project webcasting, my concept is to capture the desktop of the host computer as an image/jpeg file and save it to the database, by having a common database VB.NET and ASP.NET can connect. And lastly, get the image/images from the database and render it to ASP.NET. 1.) VB.NET -> capture image 2.) MYSQL...

what is the best way to get an approximate number of search results from a query?

to describe it some more, if i have an image map of a region that when clicked, a query is performed to get more information about that region.my client wants me to display an approximate number of search results while hovering over that region image map.my problem is how do i cache? or get that number without heavily exhausting my serve...

PHP and MYSQL maximum variable length?

I'm trying to do an INSERT into a mysql db and it fails when any of the values are longer than 898 characters. Is there somewhere to get or, better, set this maximum value? I'll hack the string into chunks and store 'em in separate rows if I must, but I'd like to be able to insert up to 2k at a time. I'm guessing this is php issue as us...

Is it possible to supersede the ORDER BY clause in mysql?

By that I mean... if I have a column named "special" and rows that are marked 1 in that column would appear at the top of the results, even if the ORDER BY clause would list them elsewhere. For example, I display items by date, in descending order. Items that are marked special=1 would appear at the top of the results, regardless of thei...

mysql tables structure - one very large table or separate tables?

I'm working on a project which is similar in nature to website visitor analysis. It will be used by 100s of websites with average of 10,000s to 100,000s page views a day each so the data amount will be very large. Should I use a single table with websiteid or a separate table for each website? Making changes to a live service with 100...

SQL LIKE query failing - fatal error in prepared statement

I have the following code: $countQuery = "SELECT ARTICLE_NO FROM ? WHERE upper(ARTICLE_NAME) LIKE '% ? %'"; if ($numRecords = $con->prepare($countQuery)) { $numRecords->bind_param("ss", $table, $brand); $numRecords->execute(); $data = $con->query($countQuery) or die(print_r($con->error)); $rowcount = mysql_num_rows($data...

Secure MySQL backup cron job – my.cnf is not being read

I have tried to make backup cron job on my webserver running FreeBSD. Currently it looks something like this: /usr/local/bin/mysqldump --opt --single-transaction --comments --dump-date --no-autocommit --all-databases --result-file=/var/backups/mysql/all.sql It works fine when I run it as root (since root has a .my.cnf with the use...

mysql - unix time vs datetime

I'm writing a php/mysql application which is similar to website visitors tracking solutions. It will handle 100,000s of inserts a day and will be able to be queried by counting pageviews/day etc... I wonder if from terms of performance its better to keep time as integer (unix time) or as mysql time. Any idea on effect on performance? S...

Multiple MySQL versions

We have a Linux server running Red Hat Enterprise 3 and MySQL 3.23. This server has a number of websites on it. We have a new website that we want to put on this server that uses MySQL 4/5. Is it possible to run the two versions of MySQL in parallel? If so, how? ...

MySQL query to assign a unique random number to each row

Hi I wish to attach a column to my table which will be a random number from a sequential list = to the number of rows. So, if my table had 999 rows, then the numbers 1 to 999 would be assigned randomly and uniquely. Now, I figured that I could add a dummy TempRandomColumn=Rand(), sort by that and add the numbers sequentially using PHP...

Fast page retrieval in MySQL, index usage?

I would like to speed a MySQL query that basically retrieve a page of data following the pattern below select my_field_A, my_field_B where time_id >= UNIX_TIMESTAMP('1901-01-01 00:00:00') AND time_id < UNIX_TIMESTAMP('2009-01-16 00:00:00') The field time_id is an MySQL index, yet, the query behaves as if the entire database was ...

How to group similar News

I'm trying to build a rss-news fetching server to collect all news of a few sites about a topic. Often these sites have similar news with nearly the same information. How would it be possible to group such news. For example display the first and then a summary of other links? Does anybody have experince with this? ...

Choosing a Platform C#/MsSql or Php/Mysql or JSP or what?

Hi all, It seems like there are an inordinate number of really intelligent people here, so I thought it was the best place to ask a couple involved questions (shameless flattery). Your feedback on any item would be so appreciated. I am about to develop a very large web based operations, inventory, sales management system. I had inten...