SQL (Stripping the SQL code to create a framework) ?

Discussion in 'MySQL' started by Scorpiono, Jun 6, 2010.

  1. #1
    Hi guys,

    I've made my database via phpmyadmin and now I've decided to add the whole structure to a .php file which creates the database in case it doesn't exist.

    How can I export the structure (without values) including "CREATE" functions of an existing SQL database?

    Cheers,
    Scorpiono
     
    Scorpiono, Jun 6, 2010 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    when you created the database in phpmyadmin, it will return a query of how it executes/creates the database.. try creating a sample database in phpmyadmin and it will give you that query.
     
    bartolay13, Jun 7, 2010 IP
  3. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #3
    That's a solution but what if my database has tons of tables, isn't there an easier way to strip it ?
     
    Scorpiono, Jun 23, 2010 IP
  4. silv3r.m00n

    silv3r.m00n Active Member

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #4
    show create table students; would show you the create table syntax for the table students.
    Alternatively you can use mysqldump command to get the create syntax of all table , and not the data using appropriate switch/options
     
    silv3r.m00n, Jun 29, 2010 IP
  5. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #5
    ty silv3r.m00n :)
     
    Scorpiono, Jun 30, 2010 IP