If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!
Why use a DDL file?
Why would you need a structure-only .sql DDL file anyway?
Maybe you want to build out a tables’ structure on another server to bring in different data or something comparable, and want it void of any existing data.
Rather than creating the table by hand with manual MySQL commands, simply use the .sql DDL dump file.
The target table I’m using for the examples in this post is a fictitious project table with this structure:
How to create a DDL only .sql file with phpMyAdmin
Click the Export tab located in the top ribbon of phpMyAdmin:
Are you a Medium member? If so, receive an email notification each time I publish a blog post if you prefer the Medium platform. Not a member? No worries! Use my sign-up link (I will get a commission at no extra cost to you) and join. I really enjoy reading all the great content there and I know you will too!!!
In the Export method section, select the Custom – display all possible options radio button and make sure the Format dropdown is set to SQL:
In the Format-specific options section, click the structure radio button:
Keeping all of the other configuration options to their defaults, simply click the Go button located in the bottom right of the window to complete the Export:
I write a weekly email about SQL/PHP that I’m studying, learning about, and interested in. If that sounds like something you would like to be a part of, find out more about it here. Thank you!
Shown in the below Github gist, is the entire .sql dump file with the project tables’ DDL:
Way easy, right?!?
Like always, if you have questions or see any mistakes in the code, please share them freely in the comments section. Constructive comments help me provide accurate and valuable content and are much appreciated!
Consider making a donation as I continue to provide valuable content here on my blog. Thank you so much!!! Every bit is much appreciated and helps tremendously!
Enjoy these blog posts I have written on similar topics. Please share them with other readers as well. Thank you!
- Use MySQL Unique Constraint in phpMyAdmin
- PHP strtoupper() and strtolower() String Functions
- MySQL’s AUTO_INCREMENT Attribute
Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!
A Call To Action!
Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.
Visit the Portfolio-Projects page to see blog posts/technical writing I have completed for clients.
Be sure and visit the “Best Of” page for a collection of my best blog posts.
Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.
Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.