SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DROP all the tables of a db without having to name them

    Hi,

    I would like to know if there is a query that would do that for me.

    I don't know the tables names, I don't know how many there are.

    So two questions in one

    1. what would be the query to drop all the tables of a given db without having to name them?

    2. how to check the number of tables in a given db and return their name?

    thanks

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    1. Drop the entire database using DROP DATABASE db_name.

    2. It depends on which scripting/programming language you are using. Some languages have specific functions for that (for example, PHP has a function called mysql_list_tables). However, you can also obtain the list by executing the following query: SHOW TABLES.

    Yours, Erik.
    ERIK RIKLUND :: Yes, I've been gone quite a while.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •