Jump to content
xisto Community
Eggie

Auto Generating Sql Database

Recommended Posts

IS it possible?? is there any program that does such a thing??create tables automatically when i tell him which script to do it on??and how much would a guy ask from me to do it instead of me??Thanks...Eggie

Share this post


Link to post
Share on other sites

I guess such program would exist, but if it's not too difficult your requirements, why not just ask someone here who maybe able to do it for you?Cheers,MC

Share this post


Link to post
Share on other sites

is there any program that does such a thing??create tables automatically when i tell him which script to do it on??

If you want to learn-by-example and see how other people solved this kind of things, download the phpbb forum files (it's free) and look how their php scripts automatically all the tables in a given database.

Share this post


Link to post
Share on other sites

I am trying to do it myself...i downloaded some mysql program(of which i don't know name cause i'm at work) , and creating one table at the time and one collumn at the time ;)I'll also try learning with phpbb forums ;)Thanks...Eggie

Share this post


Link to post
Share on other sites

if you know how to write mysql statements.
Then you can mysql's management tool
(both mysql.exe and its GUI client, download the later from http://www.mysql.com/) or
phpmyadmin will do so. Just ending each of
statement with a semi-colon.

And much like this,

create table if not exists `test10` (`id` bigint auto_increment,`first_name` varchar(20),primary key(id))engine=myisam charset=utf8;create table if not exists `test11` (`id` bigint auto_increment,`first_name` varchar(20),primary key(id))engine=myisam charset=utf8;

Place this code into a plain text file on the local file system.
For windows, use notepad ; for linux like systems, use vi.

With mysql console client:
Enter the . command following a space and the path-to-code-saved-above.

Welcome to the MySQL monitor.  Commands end with; or \g.Your MySQL connection id is 2 to server version: 5.0.27-community-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> \. f:\temp\dbscheme.sqlQuery OK, 0 rows affected (0.07 sec)Query OK, 0 rows affected (0.05 sec)

For phpMyAdmin:
Just place the code above into a sql query and then click run.
All tables within the code will be create in on shot.

Share this post


Link to post
Share on other sites

If you have a copy of Microsoft Excel (or similar spreadsheet application that can save the table as a CSV file) then you can import the table using phpMyAdmin and it will create the table for you. Simply create your table in excel, click 'Save As'. change the file type to CSV and save it somewhere you can remember. Then all you need to do is go to phpMyAdmin, click the 'Import' tab along the top, change the format to CSV then click browse to locate the table you've just saved. Hopefully it should then create the table for you automatically, and also if the table you created has data in the rows then each row will be created also. I prefer just to use SQL queries to create my tables personally, it's not hard to learn at all, but the above method is another way of doing it. There is also an app out there called PHP Maker, which kind of does the opposite to what you want. It takes all the data from a database (not necessarily MySQL but all SQL such as Oracle etc.) and constructs a website based on your parameters. This is useful for people who own a business and have a catalogue database and want to create a website quickly so people can browse their catalogue, or an admin wants to add more data to the database in a user-friendly fashion. Hope the above helps you!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.