Re: Foreign Key Error

2011-02-14 Thread Victor Subervi
gt; -Original Message- > From: Victor Subervi [mailto:victorsube...@gmail.com] > Sent: Monday, February 14, 2011 3:09 PM > To: mysql@lists.mysql.com > Subject: Foreign Key Error > > Hi; > I have this command: > > create table if not exists categoriesRelationships (ID

Foreign Key Error

2011-02-14 Thread Victor Subervi
Hi; I have this command: create table if not exists categoriesRelationships (ID integer auto_increment primary key, Store varchar(60), Parent integer not null, foreign key (Parent) references categories (ID), Child integer not null, foreign key (Child) references categories (ID)) engine=innodb; s

Too Strange for Words

2010-09-18 Thread Victor Subervi
Hi; Can someone please explain to me why Passengers.weight comes up null for the last value sometimes, and other times it comes up with the value 155?? mysql> select p.id, c.id, p.name, p.weight, m.amount, p.round_trip, c.first_name, c.middle_name, c.last_name, c.suffix, c.sex, p.confirmation, m.t

Re: Complex Select Query

2010-08-24 Thread Victor Subervi
s *way* too complex for my needs. I just thought I'd make my presentation of data a little cleaner but frankly it ain't worth going through all that learning and experimentation to do it. If there isn't another way I'll just forget about it. Any other suggestions would be n

Complex Select Query

2010-08-24 Thread Victor Subervi
Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category, c.parent; mysql> describe products; +-+--+--+-+-++ | Field | Type

Join Problem

2010-08-16 Thread Victor Subervi
Hi; I have this code: select f.id from Flights f join Planes p where f.plane_id=p.id and p.in_service=1 mysql> describe Flights; +-+---+--+-+-++ | Field | Type | Null | Key | Default | Extra | +-+-

Re: Why Does This Drop Fail?

2010-07-22 Thread Victor Subervi
On Thu, Jul 22, 2010 at 9:09 AM, John Daisley wrote: > Sorry, my bad! Must learn to read the whole message!! > > > This can be caused because when a foreign key is created mysql adds an > index key to the column in addition to the foreign key. Why I'm not sure, > but I'm guessing its for performan

Re: Why Does This Drop Fail?

2010-07-22 Thread Victor Subervi
e. How? TIA, V > > Regards > > John Daisley > > Microsoft SQL Server 2005/2008 Database Administrator > Certified MySQL 5 Database Administrator > Certified MySQL 5 Developer > Cognos BI Developer > > Telephone: +44 (0)7918 621621 > Email: john.dais...@butterflysyste

Why Does This Drop Fail?

2010-07-22 Thread Victor Subervi
Hi; mysql> alter table personalData drop foreign key Store; ERROR 1025 (HY000): Error on rename of './test/personalData' to './test/#sql2-14ce-a61' (errno: 152) mysql> describe personalData; +---+--+--+-+++ | Field | T

Creating a Data Dictionary

2010-07-12 Thread Victor Subervi
Hi; Perhaps I have a conflict of terms here, but my googling "mysql data dictionary" turned up material that didn't seem to correspond with my problem. In python I can create dictionaries: my_dict = {'1': 'one', '2': 'two'} Now, I would like to create the equivalent of an enum in which I could util

Re: Two Primary Keys

2010-06-29 Thread Victor Subervi
2010/6/29 João Cândido de Souza Neto > I think the best, or may be the right way is to use picture_id as primary > key and a unique index to product_sku. > Yes, sounds good. So the purpose, then, is to speed lookups on fields commonly accessed. I'd forgotten that. Thanks, V

Re: Two Primary Keys

2010-06-29 Thread Victor Subervi
2010/6/29 João Cândido de Souza Neto > As far as I know, if you have an auto_increment primary key, you cant have > any other field in its primary key. > Makes sense. Actually, I was just copying what someone else gave me and adding the auto_increment, then I got to wondering, what is the purp

Two Primary Keys

2010-06-29 Thread Victor Subervi
Hi; I have the following: create table pics ( picture_id int auto_increment primary key, product_sku int not null primary key, picture_num int not null, picture_desc varchar(100), picture_data longblob ); which doesn't work I need to auto_increment and declare primary key on two fi

Re: Foreign Key Problem

2010-06-22 Thread Victor Subervi
On Tue, Jun 22, 2010 at 11:53 AM, jayabharath wrote: > Hi Victor, > > The actual problem is with the key field. > > Flights.pilot_id is set to INT NOT NULL and you had specified Pilots.id to > INT NULL. > > You have to change both the columns to NULL or else NOT NULL to avoid the > error. > Than

Re: Foreign Key Problem

2010-06-22 Thread Victor Subervi
Problem solved. I tried everything that *should* have worked and didn't. Then I just wiped the test database and started with everything *fixed* (all engine=innodb, all keys of same type, etc.) and it all worked. V

Foreign Key Problem

2010-06-22 Thread Victor Subervi
Hi; mysql> alter table Flights type=InnoDB; Query OK, 1 row affected, 1 warning (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> alter table Flights add pilot_id int not null; Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> alter table Flights add foreig

Re: Foreign Key Problem

2010-05-22 Thread Victor Subervi
This is just for the sake of future googlers of this thread. The correct mysql command is: ursor.execute('create table if not exists Passengers (id int(11) auto_increment primary key, flights_id int(11) not null, customer_id int(11) not null, foreign key (flights_id) references Flights (id), forei

Re: Another Foreign Key Problem

2010-05-21 Thread Victor Subervi
I'm canceling this thread. It belongs in the Python list. Sorry! V On Fri, May 21, 2010 at 1:24 PM, Victor Subervi wrote: > Hi; > When I try to execute this code from my Python script, I get this error: > > Traceback (most recent call last): > File > "/var/www/

Another Foreign Key Problem

2010-05-21 Thread Victor Subervi
Hi; When I try to execute this code from my Python script, I get this error: Traceback (most recent call last): File "/var/www/html/creative.vi/clients/sea-flight/reservations/create_edit_bags3.py", line 38, in ? create_edit_bags3() File "/var/www/html/creative.vi/clients/sea-flight/rese

Re: Foreign Key Problem

2010-05-20 Thread Victor Subervi
On Wed, May 19, 2010 at 12:02 PM, Shawn Green wrote: > Victor Subervi wrote: > >> On Wed, May 19, 2010 at 10:59 AM, Shawn Green > >wrote: >> >> Shawn Green wrote: >> >> > look again closely at your FK definitions. The pattern should be >>

Re: Foreign Key Problem

2010-05-19 Thread Victor Subervi
On Wed, May 19, 2010 at 10:59 AM, Shawn Green wrote: > Shawn Green wrote: > > AH! that's your mistake. You think that creating the FK will also create > the column. That does not happen. You have to define the table completely > before you can associate the columns on this table (the child table)

Re: Foreign Key Problem

2010-05-19 Thread Victor Subervi
On Tue, May 18, 2010 at 2:23 PM, Shawn Green wrote: > Shawn Green wrote: > I may be confused but how can the ID of the Passengers table be both the ID > of the Flight they are taking and their Customer ID at the same time? > > http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.h

Re: Foreign Key Problem

2010-05-18 Thread Victor Subervi
On Tue, May 18, 2010 at 1:09 PM, Shawn Green wrote: > Johan De Meersman wrote: > > For additional details about failed FK attempts, check the error details in > the SHOW INNODB STATUS report. > I get this: 100518 10:26:22 Error in foreign key constraint of table seaflight/Passengers: constrain

Re: Foreign Key Problem

2010-05-18 Thread Victor Subervi
light/Passengers.frm' (errno: 150) So apparently it didn't like my foreign key. Do I need to do something with the table I'm referencing or what? TIA, V > > > On Tue, May 18, 2010 at 3:44 PM, Victor Subervi > wrote: > >> Hi; >> mysql> create table if not

Foreign Key Problem

2010-05-18 Thread Victor Subervi
Hi; mysql> create table if not exists Passengers (id int unsigned auto_increment primary key, foreign key (id) references Flights (flights_id), foreign key (id) references Customers (customer_id), name varchar(40), weight tinyint(3)); Query OK, 0 rows affected (0.00 sec) mysql> select c.first_name

Re: tmp tables

2010-01-15 Thread Victor Subervi
On Thu, Jan 14, 2010 at 1:35 AM, Chris W <4rfv...@cox.net> wrote: > I think the reason the other poster was so harsh is because others have > suggested the right way to do it, if not in a lot of detail, and you have > just argued with them. > I don't recall anyone doing that. I don't recall argui

Re: tmp tables

2010-01-13 Thread Victor Subervi
On Wed, Jan 13, 2010 at 2:33 PM, Johnny Withers wrote: > No one designs a shopping cart system this way. > > http://www.google.com/search?q=shopping+cart+database+table+design > > If you are dead set on this crazy design it doesn't matter if you put the > temp tables in the main database or anothe

Re: tmp tables

2010-01-13 Thread Victor Subervi
On Mon, Jan 11, 2010 at 3:21 PM, mos wrote: > At 09:56 AM 1/11/2010, Johnny Withers wrote: > >> Victor, >> >> The temporary table solution is not a good one. Use a single table and >> store >> each item put into a cart identified by the session ID of the user. A >> process should clean out this t

Re: tmp tables

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 11:38 AM, Keith Murphy wrote: > Victor, > > Don't want to butt in, and not trying to be rude, but he gave you advice. > You don't seem inclined to take it. How else can he, or anyone else, help > you? Clearly you don't understand some fundamental issue about relational > da

Re: tmp tables

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 10:49 AM, Baron Schwartz wrote: > Victor, > > > That strikes me as messy. Each tmp table has as many rows as necessary > for > > the products that are to be bough. To do as you say I would have to > create a > > table with a zillion rows to accommodate however many product

Re: tmp tables

2010-01-11 Thread Victor Subervi
On Mon, Jan 11, 2010 at 10:35 AM, Baron Schwartz wrote: > Victor, > > On Sun, Jan 10, 2010 at 1:20 PM, Victor Subervi > wrote: > > Hi; > > I have a shopping cart that will spawn a tmp table for every shopping > cart > > instance. Would it be better to cre

tmp tables

2010-01-10 Thread Victor Subervi
Hi; I have a shopping cart that will spawn a tmp table for every shopping cart instance. Would it be better to create a separate database for these instead of having them in the same database as all the other tables for the shopping cart? TIA, Victor -- The Logos has come to bear http://logos.13g

Re: Another Inserting Multiple Values with Set Problem

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 9:29 AM, Thiyaghu CK wrote: > Hi Victor, > > Take out the double quotes from[ "('Small,Medium,XSmall')", > "('teal_E2725B,black_FF,yellow_9ACD32')"]. Its working fine for me. > > mysql> insert into products (sizes, colorsShadesNumbersShort) > values(('Small,Medium,XSmal

Re: Another Inserting Multiple Values with Set Problem

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 2:26 AM, Thiyaghu CK wrote: > Hi Victor, > > You have given space after the comma(shown here: ('Small, Medium, > XSmall')). Take out the space and try, it will work. > > Example: > > mysql> insert into products(sizes) values ('Small,Medium,small,medium'); > Query OK, 1 row

Re: Another Inserting Multiple Values with Set Problem

2010-01-07 Thread Victor Subervi
OK, guys, I'm totally confused: mysql> insert into products (SKU, Category, Name, Title, Description, Price, SortFactor, Availability, OutOfStock, Weight, ShipFlatFee, ShipPercentPrice, ShipPercentWeight, sizes, colorsShadesNumbersShort) values ("prodSKU1", "prodCat1", "name1", "title1", "descr",

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:40 PM, Michael Dykman wrote: > How about you show us the schema for the table so we know what is > defined as what? > Done in last email. > > Also, as the update does succeed, it would be interesting to see what > value actually got stored. After you have accounted for

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:34 PM, Hassan Schroeder wrote: > On Wed, Jan 6, 2010 at 1:25 PM, Victor Subervi > wrote: > > > mysql> update products set SKU="prodSKU2", Category="prodCat1", > > Name="name2", Title="title2", Descripti

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:18 PM, Hassan Schroeder wrote: > On Wed, Jan 6, 2010 at 11:39 AM, Victor Subervi > wrote: > > > Here's my example again. Syntactically correct. From my original post: > > > > update products set SKU="prodSKU2", Category=&

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
On Wed, Jan 6, 2010 at 12:14 PM, Michael Dykman wrote: > so you dropped the quotes around the unneccessarily bracketed > expression? It's hard to diagnose when your example isn't even what > you think is syntactically correct. > Here's my example again. Syntactically correct. From my original p

Re: Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
; colorsShadesNumbersShort='aqua:7FFFD4, blue:99, gray:465945, > navy-blue:CC7722, black:FF, maroon:B03060, > purple:50404D,yellow:9ACD32, fuchsia:FF77FF' > where ID="2"; > > watch for the line-wraps in the SET data specifications.. I did both >

Another Inserting Multiple Values with Set Problem

2010-01-06 Thread Victor Subervi
Hi; The following doesn't work with or without enclosing the sets in quotes: update products set SKU="prodSKU2", Category="prodCat1", Name="name2", Title="title2", Description="descr", Price="22.55", SortFactor="500", Availability="1", OutOfStock="0", Weight="5.5", ShipFlatFee="10.0", ShipPercentP

Re: How Set Up This Table

2010-01-04 Thread Victor Subervi
On Mon, Jan 4, 2010 at 10:40 AM, Arthur Fuller wrote: > The ProductPackages table is what is known as an associate table, and is > used to implement a many-to-many relationship. You only need it if a given > product can be in multiple packages. If not, then you can eliminate the > associative tabl

Re: How Set Up This Table

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 11:20 AM, Arthur Fuller wrote: > Hi Victor. > > I think that the first thing you need to consider is whether a product can > be in more than one package, and second is whether a package can be in > another package. Also, I don't know why you need to auto-generate in either >

Re: How Set Up This Table

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 12:03 PM, prabhat kumar wrote: > primary key Oh! PK is primary key! > a compound key is a key that consists of 2 or more attributes that uniquely > identify an entity occurrence. Thanks. V

Re: How Set Up This Table

2010-01-02 Thread Victor Subervi
On Sat, Jan 2, 2010 at 11:20 AM, Arthur Fuller wrote: > Hi Victor. > > I think that the first thing you need to consider is whether a product can > be in more than one package, and second is whether a package can be in > another package. Also, I don't know why you need to auto-generate in either >

Re: Inserting Multiple Values with Set

2010-01-01 Thread Victor Subervi
On Fri, Jan 1, 2010 at 4:34 PM, Don Read wrote: > On Fri, 1 Jan 2010 14:34:48 -0500 Victor Subervi said: > > > Hi; > > > > The following insert chokes when I try to insert multiple values from the > > sets: > > > > insert into products (SKU,

Inserting Multiple Values with Set

2010-01-01 Thread Victor Subervi
Hi; mysql> describe products; +--+---+--+-+-++ | Field| Type | Null | Key | Def

How Set Up This Table

2010-01-01 Thread Victor Subervi
Hi; I have a table with products for a store to sell. I need to autogenerate from code a table or series of tables into which I can enter (and from which I can retrieve) the ID numbers of products which I am going to associate together and their package price. Product associations will vary, in tha

Re: last_insert_id

2009-12-27 Thread Victor Subervi
On Sun, Dec 27, 2009 at 1:30 PM, Gary Smith wrote: > Victor Subervi wrote: > >> On Sun, Dec 27, 2009 at 12:00 PM, Michael Dykman >> wrote: >> >> >> >>> last_insert_id() returns the last id auto-incremented in *the current >>> session*. If

Re: last_insert_id

2009-12-27 Thread Victor Subervi
On Sun, Dec 27, 2009 at 12:00 PM, Michael Dykman wrote: > last_insert_id() returns the last id auto-incremented in *the current > session*. If you disconnect and reconnect, it can not be retrieved. > Ahah! So how do I retrieve the last id inserted irrespective of connection? TIA, V

Re: last_insert_id

2009-12-27 Thread Victor Subervi
On Sun, Dec 27, 2009 at 11:27 AM, Mattia Merzi wrote: > 2009/12/27 Victor Subervi : > > mysql> select * from products; > [...] > > mysql> select last_insert_id() from products; > [...] > > Now, I was expecting 1, not 0! What up? > > [...] LAST_INSER

last_insert_id

2009-12-27 Thread Victor Subervi
Hi; mysql> select * from products; ++--+--+---++-+---++--++-+--+---+--+---+---++--+--+--+--+--

Re: Join Statement

2009-12-14 Thread Victor Subervi
On Mon, Dec 14, 2009 at 1:04 PM, Peter Brawley wrote: > ...on t.ProdID-p.ID... _subtracts_ the two IDs. To match them use '=' > rather than '-'. > Thank you for all of you that caught that. V

Re: Join Statement

2009-12-14 Thread Victor Subervi
On Mon, Dec 14, 2009 at 12:37 PM, Peter Brawley wrote: > > ... on t.ProdID-p.ID; > > Your join clause subtracts the two IDs, so it's on IDs that differ, and > apparently there aren't any. > I beg to differ: mysql> select SKU, Quantity, Name, Price, p.sizes, p.colorsShadesNumbersShort from tem1

Join Statement

2009-12-14 Thread Victor Subervi
Hi; I have the following: mysql> select SKU, Quantity, Name, Price, p.sizes, p.colorsShadesNumbersShort from tem126080739853 t join products p on t.ProdID-p.ID; Empty set (0.00 sec) mysql> select * from tem126080739853; +++--+-+--+ | ID | Pr

Re: Duplicate Entry, But Table Empty!

2009-12-13 Thread Victor Subervi
On Sun, Dec 13, 2009 at 12:21 PM, Pinter Tibor wrote: > Victor Subervi wrote: > >> Hi; >> >> mysql> insert into *tem126072414516* (ProdID, Quantity) values ("2", "2"); >> mysql> select * from *tem126072385457*; >> > > mys

Duplicate Entry, But Table Empty!

2009-12-13 Thread Victor Subervi
Hi; mysql> insert into tem126072414516 (ProdID, Quantity) values ("2", "2"); ERROR 1062 (23000): Duplicate entry '2' for key 2 mysql> select * from tem126072385457; Empty set (0.00 sec) mysql> describe tem126072385457; +--+-+--+-+-++ | Field

Re: inserting sets of data

2009-12-12 Thread Victor Subervi
On Sat, Dec 12, 2009 at 10:58 AM, David Giragosian wrote: > On Sat, Dec 12, 2009 at 9:54 AM, Victor Subervi > wrote: > >> Hi; >> I have a column defined as a set. How do I insert data into that column? >> Please give me an example. >> TIA, >> Victor

inserting sets of data

2009-12-12 Thread Victor Subervi
Hi; I have a column defined as a set. How do I insert data into that column? Please give me an example. TIA, Victor

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 8:43 AM, Johan De Meersman wrote: > On Fri, Dec 11, 2009 at 11:19 AM, Mark Goodge > wrote: > > > Jørn Dahl-Stamnes wrote: > > > >> On Friday 11 December 2009 10:38, Victor Subervi wrote: > >> > >>> Hi; > >&g

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 5:33 AM, wrote: > > On Fri, 11 Dec 2009 05:28:41 -0500, Victor Subervi > > wrote: > > On Fri, Dec 11, 2009 at 5:13 AM, wrote: > > > >> > >> On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi > >> > >>

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 5:13 AM, wrote: > > On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi > > wrote: > > > mysql> update products set sizes="('Small', 'Large')" where > SKU='prodSKU1'; > > Query OK, 0 rows af

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 4:43 AM, wrote: > > On Fri, 11 Dec 2009 04:38:01 -0500, Victor Subervi > > wrote: > > Hi; > > > > mysql> update products set sizes="('Small', 'Large')" where ID=0; > > Query OK, 0 rows affect

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes wrote: > On Friday 11 December 2009 10:38, Victor Subervi wrote: > > Hi; > > > > mysql> update products set sizes="('Small', 'Large')" where ID=0; > > Query OK, 0 rows affected, 1 war

Re: Update Doesn't Update!

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 4:48 AM, Jørn Dahl-Stamnes wrote: > On Friday 11 December 2009 10:38, Victor Subervi wrote: > > Hi; > > > > mysql> update products set sizes="('Small', 'Large')" where ID=0; > > Query OK, 0 rows affected, 1 war

Update Doesn't Update!

2009-12-11 Thread Victor Subervi
Hi; mysql> update products set sizes="('Small', 'Large')" where ID=0; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1 mysql> select sizes, colorsShadesNumbersShort from products where ID=0; +---+--+ | sizes | colorsShadesNumbers

Re: Second Request: Challenging Select Statement

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 8:08 AM, Tom Worster wrote: > On 12/7/09 5:26 AM, "Victor Subervi" wrote: > > > Hi; > > I posted this Saturday. Perhaps it's too challenging for those who read > it > > to answer. I hope someone can. > > > > I need

Second Request: Challenging Select Statement

2009-12-07 Thread Victor Subervi
Hi; I posted this Saturday. Perhaps it's too challenging for those who read it to answer. I hope someone can. I need to write a select statement that enables me to select column 'ID' from a table where a certain value is found in an enum of a specific column. For example... select column_type fro

Re: Select Problem

2009-12-07 Thread Victor Subervi
On Sun, Dec 6, 2009 at 2:42 PM, Steve Edberg wrote: > At 1:26 PM -0500 12/6/09, Victor Subervi wrote: > >> Hi; >> I have the following: >> >> mysql> select * from categoriesProducts as c inner join >> relationshipProducts >> as r on c.ID = r.Child i

Select Problem

2009-12-06 Thread Victor Subervi
Hi; I have the following: mysql> select * from categoriesProducts as c inner join relationshipProducts as r on c.ID = r.Child inner join categoriesProducts as p on r.Parent = p.ID where p.Category = prodCat2; ERROR 1054 (42S22): Unknown column 'prodCat2' in 'where clause' mysql> describe categorie

Re: Auto Increment Problem

2009-12-05 Thread Victor Subervi
Oops. Never mind. V On Sat, Dec 5, 2009 at 1:19 PM, Victor Subervi wrote: > Hi; > > mysql> insert into categories (Category, Parent) values ('test', NULL); > ERROR 1062 (23000): Duplicate entry '0' for

Auto Increment Problem

2009-12-05 Thread Victor Subervi
Hi; mysql> insert into categories (Category, Parent) values ('test', NULL); ERROR 1062 (23000): Duplicate entry '0' for key 1 mysql> describe categories; +--+-+--+-+-+---+ | Field| Type| Null | Key | Default | Extra | +--+

Challenging Select Statement

2009-12-05 Thread Victor Subervi
Hi; I need to write a select statement that enables me to select column 'ID' from a table where a certain value is found in an enum of a specific column. For example... select column_type from information_schema.columns where table_name='products' and column_name='Categories'; will give me the co

Re: Like Syntax

2009-12-05 Thread Victor Subervi
On Sat, Dec 5, 2009 at 11:09 AM, Michael Dykman wrote: > show tables like 'categories%'; > Thanks. V

Like Syntax

2009-12-05 Thread Victor Subervi
Hi; I remember vaguely how to do this but don't know how to google it: show tables like categories$; such that it will return tables such as: categoriesProducts, categoriesPrescriptions, etc. TIA, Victor

Re: Creating Table Through Union

2009-11-22 Thread Victor Subervi
On Sun, Nov 22, 2009 at 9:29 PM, Gavin Towey wrote: > The form would be like: > > CREATE TABLE products > SELECT b0basics, b0fieldValues, s0prescriptions, > s0prescriptions0doctors, s0prescriptions0patient, pics FROM table1 > UNION > SELECT b0basics, b0fieldValues, s0prescriptions, > s0prescripti

Creating Table Through Union

2009-11-22 Thread Victor Subervi
Hi; I would like to create a table out of merging the fields in other, previously created tables. I have the following syntax which doesn't work: create table products union (b0basics, b0fieldValues, s0prescriptions, s0prescriptions0doctors, s0prescriptions0patient, pics); Please advise. TIA, Vic

Re: Foreign Keys Problem

2009-11-20 Thread Victor Subervi
On Thu, Nov 19, 2009 at 9:34 PM, Ye Yuan wrote: > Hi Victor, > > It looks to me the foreign key syntax is wrong. Can you create the > Relationship table on your database by using below ddl? > > create table if not exists Relationship > (ID integer auto_increment primary key, > Parent integer not

Foreign Keys Problem

2009-11-19 Thread Victor Subervi
Hi; I don't claim to be an expert in MySQL. The following code was largely supplied to me by someone who was. I don't really understand foreign keys. He wrote this off the top of his head, and it's throwing an error. Here's the python code: def catTree(): user, passwd, db, host = login() datab

Re: Grant Privileges Problem

2009-11-09 Thread Victor Subervi
Never mind. Had to add @'localhost' On Mon, Nov 9, 2009 at 4:20 PM, Victor Subervi wrote: > Hi; > I created a user and then granted privileges: > grant all to victor identified by 'pw'; > Looked good. Tried to log in as victor an no go. Please advise. > Victor >

Grant Privileges Problem

2009-11-09 Thread Victor Subervi
Hi; I created a user and then granted privileges: grant all to victor identified by 'pw'; Looked good. Tried to log in as victor an no go. Please advise. Victor

Re: Inserting an Image

2009-10-16 Thread Victor Subervi
$&1' > > > > > > Another thing to think about is storing image data directly in a database > is often not a good idea. See these links for more info: > > > > > http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database.htmland > http://hashmysql

Inserting an Image

2009-10-15 Thread Victor Subervi
Hi; I have successfully inserted images, like yesterday, before into MySQL with the following code: sql = 'update productsX set pic1="%s" where ID=2;' % pic1 cursor.execute(sql) where pic1 is simply an image uploaded through a form then sent over without any alteration to another (pyth

Re: No tuples, but AttributeError about tuple!

2009-10-05 Thread Victor Subervi
4, pic5, pic6) values('1', 'name1', > 'title1', 'descr1', '1.1', '2', '1', 'New', '1.5', 'new', 'princesse', > 'princesse', '123 princesse', 'Not furnishe

Re: No tuples, but AttributeError about tuple!

2009-10-05 Thread Victor Subervi
think is the 2 param form of cursor.execute() which > takes a string statement and a tuple of arguments: > > cursor.execute('insert into products values(%s, %s, %s, %s, %s, %s, %s, %s, > %s, > %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' , (id, name, title, > description,

No tuples, but AttributeError about tuple!

2009-10-04 Thread Victor Subervi
Hi; I have the following python code: sql = 'insert into products values(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);', (id, name, title, description, price, bedrooms, bathrooms, conditions, acreage, construction, location, estate, address, furnished, pic1,

Re: Another Join Problem

2009-10-02 Thread Victor Subervi
Thanks V On Fri, Oct 2, 2009 at 11:08 AM, Mark Goodge wrote: > Victor Subervi wrote: > >> Hi; >> I get the following error: >> >> *SQL query:* >> >> SELECT ID, Item >> FROM products >> JOIN categories ON categories.ID = products.Category &g

Another Join Problem

2009-10-02 Thread Victor Subervi
Hi; I get the following error: *SQL query:* SELECT ID, Item FROM products JOIN categories ON categories.ID = products.Category LIMIT 0 , 30; *MySQL said:* #1052 - Column 'ID' in field list is ambiguous Please note the error is about ambiguity. "products" has an ID field and so does "categorie

Re: Nested Joins

2009-10-02 Thread Victor Subervi
now **exactly** what you’re sending to mysql. > > > > Regards, > > Gavin Towey > > > > *From:* Victor Subervi [mailto:victorsube...@gmail.com] > *Sent:* Thursday, October 01, 2009 3:04 PM > > *To:* Gavin Towey; mysql@lists.mysql.com > *Subject:* Re: Nested Join

Re: Nested Joins

2009-10-01 Thread Victor Subervi
t; > http://hashmysql.org/index.php?title=Introduction_to_Joins > > For more indepth info: > http://dev.mysql.com/tech-resources/articles/mysql-db-design-ch5.pdf > > http://dev.mysql.com/doc/refman/5.1/en/join.html > > > > Regards, > > Gavin Towey > > > > *From:* V

Re: Nested Joins

2009-10-01 Thread Victor Subervi
On Thu, Oct 1, 2009 at 4:03 PM, Gavin Towey wrote: > Joins aren't nested like that, unless you use a subquery. I think you just > need to remove the parens around the second join. > I tried that and no go :( > > For better help: > 1. show the real SQL -- echo the statement. Most people here d

Nested Joins

2009-10-01 Thread Victor Subervi
Hi; I'm new to join statements. Here's my python syntax: cursor.execute('select * from %s left join products on %s.Item=products.Item (left join categories on products.Category=categories.ID);' % (client, client)) I believe it's clear how I want to nest, but I don't know how to repair my syntax

Re: Create Syntax (easy)

2009-09-29 Thread Victor Subervi
That's it! Thanks, V On Tue, Sep 29, 2009 at 12:13 PM, David Giragosian wrote: > On Tue, Sep 29, 2009 at 11:09 AM, Victor Subervi >wrote: > > > Hi; > > Please give me the syntax below such that I can force the insert > statements > > to use only select

Create Syntax (easy)

2009-09-29 Thread Victor Subervi
Hi; Please give me the syntax below such that I can force the insert statements to use only selected values ("item1", "item2", "item3"): create table (field SOMETHING_HERE item1 item2 item3, ... ) TIA, Victor

Re: Problem w/ mysqldump

2009-09-02 Thread Victor Subervi
together. Hence the need > for a mysql dump tool ;-) > > Mysql dump is the better way to go in either situation. > > > -Original Message- > > From: Victor Subervi [mailto:victorsube...@gmail.com] > > Sent: Wednesday, September 02, 2009 1:43 PM > > To:

Re: Problem w/ mysqldump

2009-09-02 Thread Victor Subervi
t; > > -Original Message- > > From: news [mailto:n...@ger.gmane.org] On Behalf Of Emile van Sebille > > Sent: Wednesday, September 02, 2009 7:18 AM > > To: mysql@lists.mysql.com > > Cc: python-l...@python.org > > Subject: Re: Problem w/ mysqldump > > >

Problem w/ mysqldump

2009-09-02 Thread Victor Subervi
Hi: I have the following python code: import os os.system("mysqldump -u root -pPASSWORD --opt spreadsheets > dump.sql") This nicely creates the file...but the file is empty! The database exists and has lots of data, I double-checked it. If there is nothing wrong with my code, is there some way to d

Re: Suppressing Warnings

2009-08-31 Thread Victor Subervi
;; database exists > > This is the answer. > > 2009/8/24 Victor Subervi > > Hi, >> I have the following python code: >> >> cursor.execute('create database if not exists spreadsheets;') >> cursor.execute('use spreadsheets;') >> >>

Suppressing Warnings

2009-08-24 Thread Victor Subervi
Hi, I have the following python code: cursor.execute('create database if not exists spreadsheets;') cursor.execute('use spreadsheets;') but it generates this warning: Warning (from warnings module): File "C:\Python25\mysqlConverter.py", line 140 cursor.execute('use spreadsheets;') Warn

Re: Update Syntax

2009-07-26 Thread Victor Subervi
Perfect. Thank you. Victor On Sun, Jul 26, 2009 at 2:18 PM, Darryle Steplight wrote: > Hi Vicor, >Look into INSERT ON DUPLICATE or REPLACE statements. You need to > have a primary key or unique key for these too work. > > On Sun, Jul 26, 2009 at 1:11 PM, Victor Subervi > wr

  1   2   >