Drop table in one shot

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

  • 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”

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

  • Good question, thanks!

  • Nice Question Carlo 🙂

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

  • 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”

  • Thanks for the clarification on option 2!!!

  • 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.

  • Interesting, really interesting. Thanks, Carlo!

  • 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!

  • 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).

  • Very nice and interesting question. Thanks Carlo.

  • 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 12 (of 12 total)

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