I have a script in MySQL that creates two tables, the second table references a field in the first table, now when I try to run this script in one batch it returns an error. My guess is that it checks the referenced table in the second table definition before creating the tables.
Any idea how I can create both tables at once?
Thanks
E...
I am trying to make an insert to an MySql database using a three layer solution (or what it might be called).
I have done this may times with an MS-sql database and it has worked very well.
But now when I am trying to make an insert I get the the ID can't be null.
I thought the database took care of that.
If I write an insert directly ...
Dear all,
I have to write a query wherein i need to allocate a ID (unique key) for a particular record which is not being used / is not being generated / does not exist in database.
In short, I need to generate an id for a particular record and show it on print screen.
E. g.:
ID Name
1 abc
2 def
5 ghi
So, the thing is that...
I have a MySQL 5.1 InnoDB table (customers) with the following structure:
int record_id (PRIMARY KEY)
int user_id (ALLOW NULL)
varchar[11] postcode (ALLOW NULL)
varchar[30] region (ALLOW NULL)
..
..
..
There are roughly 7 million rows in the table. Currently, the table is being queried like this:
SELECT * FROM custom...
Hi I have a image table in my database. These are stored as blob along with details such as image type & name.
I am having a problem showing the image, all I get is a white box with a red cross in it.
code:
<?php
include '../connection.php';
$ID = $_GET['id'];
$query = "SELECT * FROM `images` WHERE `image_id` = '$ID'";
$result=mysq...
given an array
$galleries = array
(
[0] => 1
[1] => 2
[2] => 5
)
I want to have a sql query that uses the values of the array in its WHERE clause like:
SELECT *
FROM galleries
WHERE id = //values of array $galleries... eg. (1 || 2 || 5) //
How can I generate this query string to u...
I'm converting some mySQL code to pgSQL and I've run into this problem
mysql code : "KEY ug_main_grp_id (ug_main_grp_id)"
What would be the equivalent in PgSQL. First I thought I could just use CREATE INDEX in pgSQL, but that's really not appropriate because KEY is not an index :P
...
when selecting ranked objects from a database (eg, articles users have voted on), what is the best way to show:
the current page of items
the user's rating, per item (if they've voted)
rough schema:
articles: id, title, content, ...
user: id, username, ...
votes: id, user_id, article_id, vote_value
is it better/ideal to:
select ...
Hi,
I am developing a back-end that process about 500 invoices a day. I have following tables in my database.
invoices
invoice_id int primary_key auto_increment
user_id varchar(10)
invoice_type enum { package, document }
users
user_id int primary_key auto_increment
rate_package_id int
rate_document_id int
rates
rate_id int
rate_nam...
Hello;
The company has an ERP application that supports only once company using one database, how to make the application support multiple companies and multiple databases using the same code?
The application is a PHP and the database is MySQL.
Thanks.
...
I'd like to select all rows from one table which match "one or more" rows in another table, in the most efficient way.
SELECT identity.id FROM identity
INNER JOIN task ON
task.identityid=identity.id
AND task.groupid IN (78, 122, 345, 12, 234, 778, 233, 123, 33)
Currently if there are multiple matching tasks this returns the same i...
Hi, is there a way to batch copy certain wikipedia articles(about 10,000) to my own mediawiki site?
EDIT:
How do I do this without overwriting similarly named articles/pages?
Also I don't plan on using illegal means (crawlers etc)
...
I've seen the two attributes in the MySQL database at table catalog_product_entity
the fields are 'created_at' and 'updated_at'
How do I get them to show up on frontend?
...
Notice: Undefined variable: username in C:\xampp\htdocs\test_class.php
on line 20
Notice: Undefined variable: password in C:\xampp\htdocs\test_class.php
on line 20
I get the above error when i use this piece of code for checking down my username and password with my database.
<?php
class test_class {
public ...
[Edit: Apparently, this is only an issue for arrays and FoxyBOA's answer might direct to (or even is) the answer.]
Hi, my question relates to these software: Hibernate3+Annotation, Spring MVC, MySQL and in this example also Spring Security.
I was wondering, why collections, which are automatically associated by Hibernate contain null v...
I have 2063 locations stored in a mysql table. In one of my processes I need to exclude certain results based on how far away they are from a given point of origin. The problem is, I will need to filter a couple of hundred, maybe a couple of thousand results at a time.
So what would be the best way to do the distance math. Should I do i...
I have 2 tables set up like this (irrelevant rows omitted):
> product
- id
- user_id
> thread
- id
- prod_id
- user_id
- due_date
now I want to create a query that picks all rows from thread table that either:
have a thread.user_id of (for example) "5"
have a prod_id where the product.user_id is "5"
I am assuming ther...
I am thinking of writing a small MySQL provisioning for my organization's internal use.
We are feeling the need as both Developers and Quality Assurance people spend a significant time in preparing databases before they can do their work.
So as a first step, I am searching for an existing open-source tool that can do basic MySQL Serve...
I have a MySQL table with 120,000 lines stored in UTF-8 format. There is one field, product name, that contains text with many accents. I need to fill a second field with this same name after converting it to a url-friendly form (ASCII).
Since PHP doesn't directly handle UTF-8, I'm using:
$value = iconv ('UTF-8', 'ISO-8859-1', $value)...
I am moving old project that used single table inheritance in to a new database, which is more structured. How would I write a SQL script to port this?
Old structure
I've simplified the SQL for legibility.
CREATE TABLE customers (
id int(11),
...
firstName varchar(50),
surname varchar(50),
address1 varchar(50),
address2 v...