I can't seem to get my cascade action going here. I've got two tables defined as the following.
Can anyone tell me what's wrong? An update to system_rigs "id" won't cascade to the messages table.
Messages Table
CREATE TABLE `edr_messages` (
`message_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rig_id` int(10) unsigned NOT NU...
I'm doing an INSERT ... ON DUPLICATE KEY UPDATE for a PRIMARY KEY in the following table:
mysql> describe users_interests;
+------------+---------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------------------+------+...
I'm writing a redirect script in PHP that will insert info about the click in a MySQL database.
Will it always insert the info if the database if I put the header() function before the insert? I want to do it this way to make the redirect as fast as possible.
$location = "Location: http://www.example.com";
header($location);
$sql = "I...
I am trying to use the progress bar for a non-traditional purpose. I want to use the functionality to display a horizontal bar graph of two values retrieved from a database.
My PHP/MySQL/JQuery:
// retrieve results for display
$query = mysql_query(" SELECT furniture_purchases, electronics_purchases FROM sales WHERE store_id = $storeId...
Hi everyone,
I need a PHP/MySQL based Bug Tracking script that will allow me to put up a downloads section and focus each download to have it's own issue list.
I can't seem to find any Bug tracking scripts that can do this.
Can anyone recommend me one, I prefer opensource, thanks.
...
Im using fulltext for searches on my site, but there are a lot of updates being done to the table also, which contains 700,000 records. these updates are usually done via cron, by a script that runs every 10 minutes and commits changes from a temporary table where I simply INSERT all the changes for speed purposes, since updating the liv...
I need to loop over a comma separated list of IDS that were passed into a stored procedure. I have seen people use locate() and substring etc but I haven't seen anything that really makes sense.
Thanks!
...
I have a table that keeps the user ratings for items.
I want to allow each user to rate an item only once, is there any way to force the database not to allow duplicate for itemId and userId?
I don't want each individual field to be a primary key.
I want the primary key to be based on both of them at the same time.
for example there i...
So usually you can just do
SELECT COUNT(field.id) FROM table WHERE field.id > 100
and COUNT(field) will return the number of entries that has the criterion of field.id > 100
But then what if you what to count entries specified with the HAVING criterion such as
SELECT COUNT(field.id), field.id * 10 AS foo FROM table HAVING foo > 100...
I'm trying to devise ordering logic for a service similar to Netflix. There are two methods to create an order; there are two major factors that determine if an order should be placed. It's impossible to write this question without considerable explanation, so bare with me.
The first way in which an order can execute is when someone ret...
SELECT id FROM films WHERE id IN (90,4,40)
result
4
40
90
but I want it return 90,4,40
what I must do? (mysql)
...
I have a sql field that i need to edit out characters on the left and right.
The table name is: cdr
The field name is: dstchannel
The dstchannel field shows the following data: Local/872@from-internal-6acb,1
I just the need the 872 as output
The field always has the same amount of data, so the 872 will be constaint on its position.
How w...
I have a typical situation.
my table has four column. (id, user, col2, status)
I want to write a query which gives me the results of col2. But it has a column status which has (0/1). So I want only col2 data which has 0 status + a user's all data (0/1).
id user col2 status
1 sam aa 1
2 sam bb 0
3 sam cc 1
4 max dd 0...
I'm trying to set a default database engine for each of my MySQL schemas, but I can't seem to find out how to do that.
I know it's possible to specify the engine at the table level, and in the config file with --default-storage-engine=type, but isn't there a way to set it at the schema level?
...
update ao
set iansweroptionresultcount = 0
from tab_answeroption ao
inner join tab_question q on q.pk_iquestion_id=ao.fk_iquestion_id
where q.fk_iquestionaire_id=qid
...
Should I create a text field or a different type of field? Is there anything else I should know before writing the insertion script? ...Or the select scripts?
...
In short: how to put a zipful of csv data into mysql?
Long: I have to create a functionality for an admin to upload bootstrap data for a java web application. The administrator should be able to upload a single zip file of csvs on the admin page. The code needs to unzip csvs and the data must be transferred saved in a mysql DB.
I know ...
hi,
one of my script required large memory. and probably because of this I am getting following error
Fatal error: Out of memory (allocated
42729472) (tried to allocate 32 bytes)
I tried to change memory_limit by using ini_set('memory_limit', '256M'); on the top of my page but still I am getting same issues. I also tried ini_set...
SELECT first_name FROM user WHERE FIRST_COLUMN = '10'
What I need to know is how to reference "FIRST_COLUMN" in MYSQL syntax. The first column can be any name and so I need to make it flexible as long it should get the 1st column of any table. thanks
...
My object model is given below and would like your inputs on the number of indexes to create for faster query responses (on h2, mysql). Assumptions and questions are given below the following model.
@Entity
@Table(name = "user")
public class User {
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true...