I have tables a and b; b references a via foreign key.
I copied a using:
create table c select * from a;
Now, I want to delete c only, but I got a foreign key constraint error. How do I remove c without removing b?
...
Hey there everyone ...
I´m using JPA with SPRING and mySQL and I´m having problems while removing an entity...
I am doing this:
@PersistenceContext
private EntityManager em;
...
@Transactional
public void delete(Long id) {
em.flush();
OwnerEntity e = em.getReference(Entity.class, Long.valueOf(id));
if (e == null)
throw new Ex...
I'm trying to write a function to SELECT the least-recently fetched value from a table in my database. I do this by SELECTing a row and then immediately changing the last_used field.
Because this involves a SELECT and UPDATE, I'm trying to do this with locks. The locks are to ensure that concurrent executions of this query won't opera...
I'm having the hardest time getting Eclipse to connect and reverse engineer from a MySQL5 database. I can see Eclipse connecting to my MySQL database and can even see the tables through the "Data Source Explorer" view but when I try it after creating Hibernate Console and Configuration files, I get the error:
org.hibernate.console.Hibe...
Hi,
Is in multithreaded application suitable to have 1 connection per 1 connected client? To me it seems ineffective but if there is not connection pooling, how it could be done when one wants to let each connection communicate with DB?
Thanks
...
Hi! I'm setting up MySQL replication via binlog. It's a master / slave setup.
I have a few questions on how to do this the best way.
Should information_schema be replicated, if yes/no, why?
Should mysql db be replicated, if yes/no, why?
If it all should be replicated, no binlog-do-db needs to be set?
Cheers.
...
I have three tables
1. MetaKey
Colmans:
ID KeyName
1 hobbies
MetaKeyValue
Colmans:
ID KeyValue:
1 skating
2 rugby
3 TV
ObjectType
ID ObjectName
1 World
2 Branch
3 Customer
MapMetaKeyMetaValue
Colmans:
ID KeyID ValueID ObjectID(Branch or Customer ) ObjectTypeID isLive
-------------------------------------------...
My query returns a sales column total for each month and a purchases total for each month, for certain categories.
SELECT theMonth,
sum(Sales) as sumSales,
sum(Saleswotax) as sumSaleswotax,
sum(Purchases) as sumPurchases,
sum(Purchaseswotax) as sumPurchaseswotax
FROM ( SELECT date_format(saledate, '%Y-%...
For Example
Let say we have 1000 products in a single category.
And we would like to Filter through these products.
As we Filter through the products using json.
Each time we have need run a separate query to the DB.
We were wondering if any one knows if it's possible display a preload the products table.
For example preload bar: ini...
query:
SELECT u.deviceID, u.userName, u.contactNo, u.rating
FROM User u
INNER JOIN TaxiQuery t ON u.deviceID = t.seat1
OR u.deviceID = t.seat2
OR u.deviceID = t.seat3
OR u.deviceID = t.seat4
WHERE t.queryID = 3;
+--------------------------------------+---------...
Hi there,
I am currently running these queries:
INSERT INTO `action_4_members` (campaign_id, mobile, join_txt, join_txt_date, additional_txt, additional_txt_date, misc_data) VALUES ('15', '6421315710', 'offprem', '2009-12-11 19:32:58', '762355', '2009-12-11 19:33:35', '')
INSERT INTO `action_4_members` (campaign_id, mobile, join_txt, j...
I'm trying to update multiple rows in one table in MySQL database by doing this. And its not working.
$query = "UPDATE cart SET cart_qty='300' WHERE cart_id = '21';
UPDATE cart SET cart_qty='200' WHERE cart_id = '23';
UPDATE cart SET cart_qty='100' WHERE cart_id = '24';";
mysql_query($query,$link);// $link is specifi...
I have a products table, with the fields product, category and cost, of type varchar, varchar and decimal.
I then have a sales table, with the fields client, productname, quantity, cost, and saledate, of type varchar, varchar, int, decimal and date.
I also have a purchases table, with the fields purchasedate, cost, quantity and purchas...
I am executing a mysql SELECT statement which takes 30 seconds to run the first time, but then just takes .2 all times after that.
I thought clearing the query cache would resolve the problem (RESET QUERY CACHE), but it still takes .2 seconds after that. Only restarting the server reverts the query back to taking 30 seconds, but then it...
I have a query which returns 3 fields, one of which is the month as a two digit number.
I want to basically have it so if month == 1 output january, if month == 02 output febuary etc
This is what I am trying, but this does not work at all, and prevent the entire column from being displayed in PHP.
while ($row = mysql_fetch...
The project: Imagine a card collector wants to create a database for all his card collections , they collect every type of trading card available. Each trading card has a different set of information (stats) depending on it's type but there could be an infinite number of categories of trading cards. So my questions is, is it better to cr...
I'm having a dilemma. I have a field hashedX that is a hashed/salted value and the salt is saved in the same row in the mysql database as is common practice.
hashedX saltX
------ ------
hashed1 ssai3
hashed2 woddp
hashed3 92ofu
When I receive inputX, I need to know if it matches any of the values in hashedX s...
Hello.
Is there a way to specify a sorting procedure for ORDER BY, or some kind of custom logic? What I need is to check some other data for the column being ordered, which is also in the row. For example if one column has a higher value than another, but a certain condition isn't met, it's sorted as lower. Right now I pull all the dat...
I'm new to Javascript/Jquery and struggling with a certain issue.
In the process of adding a job to a database, the users have an option to update the contents of dropdown lists with new options. Adding the new options is handled through a greybox which posts data with PHP through to the database.
After adding the new option it doe...
I have a page that generates json data from several fields and I want to send it to a mysql database.
I currently have a link, the user clicks the link, the javascript takes the information they've inputed and sends it to a server. Due to the nature, I need all the data in one field in the mysql database. Any ideas?
EDIT:
The data comes...