Drop table in one shot

  • Carlo Romagnano

    SSC-Insane

    Points: 21872

    Comments posted to this topic are about the item Drop table in one shot

  • Stewart "Arturius" Campbell

    SSC Guru

    Points: 71605

    Nice question, thanks Carlo
    Particularly enjoyed some of the wrong answers...

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • paul s-306273

    SSChampion

    Points: 10615

    Sorry, thought answer 2 was some sort of psuedo code.
    Bit of a strange question.

  • allinadazework

    SSCarpal Tunnel

    Points: 4365

    Good question, thanks!

  • Shayn Thomas

    SSCertifiable

    Points: 5552

    Nice Question Carlo 🙂

    ---------------------------------------------------------------------------------------
    The more you know, the more you know that you dont know

  • Stewart "Arturius" Campbell

    SSC Guru

    Points: 71605

    paul s-306273 - Tuesday, July 31, 2018 1:52 AM

    Sorry, thought answer 2 was some sort of psuedo code.
    Bit of a strange question.

    No, it isn't
    for answer 2 to work, it should have been DROP TABLE IF EXISTS b,a;

    you can test it as follows:
    DROP TABLE IF EXISTS b,a;

    CREATE TABLE a
    (
      i INT PRIMARY KEY
    );
    CREATE TABLE b
    (
      i INT PRIMARY KEY
       FOREIGN KEY REFERENCES a
    );

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • Arno.Hubert.Janssen

    SSCrazy

    Points: 2278

    Thanks for the clarification on option 2!!!

  • Kaye Cahs

    SSCarpal Tunnel

    Points: 4135

    Interesting question, Carlo. Thanks.

    I did not know that I could drop more than one table with a single statement.  At first blush, it seems like something that could lead to confusion or mistakes and that should not be encouraged.

  • Revenant

    SSC-Forever

    Points: 42467

    Interesting, really interesting. Thanks, Carlo!

  • Carlo Romagnano

    SSC-Insane

    Points: 21872

    Kaye Cahs - Tuesday, July 31, 2018 6:50 AM

    Interesting question, Carlo. Thanks.

    I did not know that I could drop more than one table with a single statement.  At first blush, it seems like something that could lead to confusion or mistakes and that should not be encouraged.

    If you know the syntax no confusion at all!

  • Revenant

    SSC-Forever

    Points: 42467

    Carlo Romagnano - Tuesday, July 31, 2018 12:54 PM

    Kaye Cahs - Tuesday, July 31, 2018 6:50 AM

    Interesting question, Carlo. Thanks.

    I did not know that I could drop more than one table with a single statement.  At first blush, it seems like something that could lead to confusion or mistakes and that should not be encouraged.

    If you know the syntax no confusion at all!

    Exactly. That's why I found it 'really interesting.' I am looking forward to your next post(s).

  • dstrickrott

    SSCommitted

    Points: 1951

    Very nice and interesting question. Thanks Carlo.

  • Michael Poppers

    SSCrazy

    Points: 2122

    Carlo Romagnano - Tuesday, July 31, 2018 12:54 PM

    Kaye Cahs - Tuesday, July 31, 2018 6:50 AM

    Interesting question, Carlo. Thanks.

    I did not know that I could drop more than one table with a single statement.  At first blush, it seems like something that could lead to confusion or mistakes and that should not be encouraged.

    If you know the syntax no confusion at all!

    ...and I didn't know that "IF EXISTS" could only be mentioned once (and would apply to the entire list of objects), so I thought option 2 (in addition to option 4) would work.  Thanks for the question!

Viewing 13 posts - 1 through 13 (of 13 total)

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