File - Create - New Table

Everything in Manifold is stored in a table.  Every bit of data, regardless of its nature - vector, raster, text, whatever, - is stored in a table.   Most GIS users naturally understand what a table is when they see data, such as attributes, in a classic row and column table presentation, but it may be a new notion to think of tables as also storing data that is used to create visual displays, such as geometry data for drawings or tile data for images.

 

To create a new table:

 

  1. Choose File - Create - New Table, or use the context menu in the Project pane.

  2. Specify a Name for the new table.

  3. Press the Edit Schema button and use the Schema dialog to add fields and indexes and computed fields as desired to the table.

  4. Press Create Table.

 

We can easily create tables as in the above, but most often the tables we work with are created as a result of importing or linking data, either tables or drawings or images, or they are created by SQL we write.

 

When creating a new table in an external DBMS that supports autogenerated identity fields, the New Table dialog automatically creates an autogenerated identity field within the table.  See the Schema topic for a discussion of autogenerated identity fields.

File - Create - New Table

 

In the main menu choose File - Create - New Table or right-click an empty spot in the Project pane and choose Create - New Table.

 

Name

Name for the table.  "Table" by default.  Specify a more informative name as desired.

Edit Schema

Launch the Schema dialog to specify the fields and indexes for the table.  By default only an mfd_id field and an mfd_id_x btree index will be created.  By default, the mfd_id field will be an INT64 data type when created within a .map project file, and will be an INT32 data type when created in a target data source that is not a .map project.

Create Table

Create the new table.

Edit Query

Launch the Command Window loaded with a query that creates the table using the given settings.  A great way to learn how to use SQL to create tables.

Cancel

 Exit the dialog without doing anything.

Tables from Queries

To learn how to create a table from an SQL query, choose File - Create - New Table and then press the Edit Query button.

 

 

Launching File - Create - New Table opens the New Table dialog.   We press the Edit Query button to launch the SQL Command Window loaded with a query that creates the table.

 

-- $manifold$

--

-- Auto-generated

-- New Table

--

CREATE TABLE [Table] (

  [mfd_id] INT64,

  INDEX [mfd_id_x] BTREE ([mfd_id])

);

 

The query above is very simple, and shows how to create a table using SQL.  To learn how to use SQL to create tables with more fields and indexes or with computed fields, first use the Edit Schema button to launch the Schema dialog to add fields, indexes or computed fields to the table, and then press the Edit Query button.

 

See Also

Getting Started

 

User Interface Basics

 

Tables

 

Data Types

 

Indexes

 

Queries

 

Drawings

 

Schema

 

File - Create - New Drawing

 

Example: Add a Computed Field to a Table - How to add a field to a table.  We first set the values for the field in a static way and then we show how to set the values for a field dynamically with a computed field.

 

Example: Create a Table with a Constraint  - Create a simple table that includes a simple constraint upon one of its fields.  

 

SQL Example: Create a Table with a Constraint via a Query -  A simple example using SQL to create a table with a constraint.

 

SQL Example: Force an Anomaly in Constraints - Constraints are only evaluated when we insert or update records.   If a constraint refers to external data, such as the values in a different table, we can force an anomalous condition where the table with the constraint may contain data that no longer meets the requirements of the constraint.

 

SQL Example: Using the mfd_id Field and mfd_id_x Index - A sequence of SQL examples of working with the mfd_id field and mfd_id_x index.