conditional update query syntax

  • jcelko212 32090

    SSCrazy Eights

    Points: 9012

    paulgq - Sunday, August 19, 2018 11:48 AM

    There are several problems with your approach, which are pretty fundamental. The first is that an update is not a query; it is a statement. Next, you have no idea what the normal forms are! If you read anything written by Dr. Codd, any book on data modeling for a decent introduction to RDBMS, you will find that the columns of a table contain scalar values, and not a dialogue. This is the foundation RDBMS and it's called First Normal Form (1NF).

    It's also considered basic netiquette, and has been for the past 30+ years, to post at least a skeleton DDL instead of a narrative.

    If you want to pull scalar values, such as the names of manufacturers, from text, then it's better to do it in the tier of your tiered architecture that handles input. There are actually some tools for doing this. Many years ago I used one called Monarch, but I don't know if it's still around.

    CREATE TABLE Suppliers
    (mfg_duns CHAR(9) NOT NULL PRIMARY KEY,
    company_name VARCHAR(15) NOT NULL);

    I am going to assume that you know what the DUNS numbers, and GTIN are, since you are working in retail.

    CREATE TABLE Catalog
    mfg_duns CHAR(9) NOT NULL
     REFERENCES Companies(duns),
    product_description VARCHAR(25) NOT NULL,

    The REFERENCES back to your list of suppliers via their DUNS is simply basic design for retail. Likewise, will be converting over to GTIN from the UPC codes you're currently using.

    Please post DDL and follow ANSI/ISO standards when asking for help. 

Viewing post 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply