There are several ways to create database tables using Entrance. One way is by pasting data from the clipboard. Another is by running a SQL script. In this tutorial, you will learn how to create database tables using the Entrance "New table..." command.
Create an empty table
Select Database | New table... and enter a table name in the dialog that appears. Done. You have created a an empty table with a single column named "Item".
Adding and deleting columns
To add a column, right click (control-click on a Mac) a column to bring up its popup menu. Select "New column...", then enter a column name.
To delete a column, select "Delete column..." from the Column popup. Be careful about this: Whenever "delete" is used, think of it as meaning "delete permanently".
Changing column types
By default, the columns you create with "New column..." are VARCHAR(255). Use the "Change column type..." pick from the Column popup menu to change this:
The Change Column Type dialog is organized into two parts: "Basic Types" and
"More Types", shown below:
Changing a column name
To change a column name, right click (control-click on a Mac) on a column to bring up the column popup menu. Select "Change column name...", then enter a column name in the dialog that appears.
Getting the SQL to (re)create a table
You can think of the column popup menu commands described above as a set of tools for authoring SQL CREATE scripts. Use them as a quick way to get the table structure you want, then generate the MySQL script for duplicating it. Right-click (control-click on a Mac) the table name in the explorer tree and select "SQL to create table" from the popup, and you will have the script.
More about SQL
The Entrance Help menu contains book marks for MySQL online documentation pages, including pages describing the SQL CREATE syntax. You can go straight to that documentation by clicking here: http://dev.mysql.com/doc/refman/5.0/en/create-table.html
You can also add columns or change column attributes using the SQL ALTER command. ALTER syntax is bookmarked in the Help menu, or you can go to the online documentation by clicking here: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
Please note: This web page and other Entrance documentation web pages are copyrighted material and have not been released under the terms of the GPL.
Copyright (c) Tod Landis 2006,2007 All Rights Reserved Modified: March 7, 2007
Java and the Java Coffee Cup Logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Solaris is a trademark of Sun Microsystems, Inc. MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries. Windows is a trademark of Microsoft Corporation. Macintosh is a trademark of Apple Computer, Inc.