Kexi/Handbook/Building Simple Databases/Designing Database Tables/The Table Designer window: Difference between revisions

From KDE UserBase Wiki
(Initial)
 
m (add formatting)
Line 1: Line 1:
==The Table Designer window==
<languages/>
===Table Designer window consists of following columns:===
<translate>
* PK - Primary Key.
===The Table Designer window===
* Field Caption - caption of the field which will be displayed during data entering.
* Data Type - a combo box containing a list of data types, allowing to set a main rule for entered data for a given field. For example, when an integer number data type is set for a field, a database user will not able to enter letter characters into this field.
* Comments - you can enter here any information useful for understanding what the given field is provided for. This additional text will be saved within the table design and only visible in design mode.


In the Table designer window, every row corresponds to a single table field. You can recognize you are in design mode because the Switch to design view button is toggled on within the main Kexi toolbar.  
====Table Designer window consists of following columns:====
 
* '''PK''' - Primary Key.
 
* '''Field Caption''' - caption of the field which will be displayed during data entering.
 
* '''Data Type''' - a combo box containing a list of data types, allowing to set a main rule for entered data for a given field. For example, when an integer number data type is set for a field, a database user will not able to enter letter characters into this field.
 
* '''Comments''' - you can enter here any information useful for understanding what the given field is provided for. This additional text will be saved within the table design and only visible in design mode.
 
In the Table designer window, every row corresponds to a single table field. You can recognize you are in design mode because the <menuchoice>Switch to design view</menuchoice> button is toggled on within the main '''Kexi''' toolbar.
 
====Procedure 3.3. Designing the Persons table====
 
# In the first row click on the cell in the '''Field Caption''' column and enter '''''Name''''' as field caption.  


===Procedure 3.3. Designing the Persons table===
# In the first row click on the cell in the Field Caption column and enter Name as field caption.
'''Notes about field names and captions'''
'''Notes about field names and captions'''
* Every table field must have a name and a caption, these cannot be empty.  
* Every table field must have a name and a caption, these cannot be empty.  
* Field name is a word used by the database, usually not visible for users of the database application. The name may not contain special (national) characters (like ±, ¶, Ü) or space characters. The name must only contain roman letters, numbers and underscore sign "_". Use the latter instead of spaces or dashes.  
* Field name is a word used by the database, usually not visible for users of the database application. The name may not contain special (national) characters (like ±, ¶, Ü) or space characters. The name must only contain roman letters, numbers and underscore sign "_". Use the latter instead of spaces or dashes.  
* Field names must be started with a letter or underscore sign "_", never with a number.  
* Field names must be started with a letter or underscore sign "_", never with a number.  
* It does not matter whether you are using small or capital letters. For Kexi the database name "Persons" is the same as "persons".  
 
* It does not matter whether you are using small or capital letters. For '''Kexi''' the database name '''''Persons''''' is the same as '''''persons'''''.  
 
* Field caption, on the other hand, allows you to enter any letters and special characters. It will be displayed for users of the database application.  
* Field caption, on the other hand, allows you to enter any letters and special characters. It will be displayed for users of the database application.  
# In a similar way, enter the following fields into the table design:
# In a similar way, enter the following fields into the table design:
* surname
* surname
Line 21: Line 36:
* house_number
* house_number
* city
* city
# All the above fields, except house_number, are of type text. Change house_number field's type to integer number. To do this, click on a cell in the Data Type column, house_number row and then click on drop down list's button (you can also press F4 or Alt+Down. The list of data types will appear. Select the Integer number type.  
# All the above fields, except '''''house_number''''', are of type text. Change '''''house_number''''' field's type to integer number. To do this, click on a cell in the '''Data Type''' column, '''''house_number''''' row and then click on drop down list's button (you can also press <keycap>F4</keycap> or <keycap>Alt+Down</keycap>. The list of data types will appear. Select the '''Integer''' number type.
 
From now on, the '''''house_number''''' field only accepts numbers.  


From now on, the house_number field only accepts numbers.  
# Persons table design is ready. Click <menuchoice>Switch to data view</menuchoice> button on the toolbar to finish designing and switch to '''Data View''' for the table. This allows you entering data into the table.
# As the design is not yet saved in the database, the '''Save Object As''' dialog window appears. You need to specify the name for the new table.  


# Persons table design is ready. Click Switch to data view button on the toolbar to finish designing and switch to Data View for the table. This allows you entering data into the table.
'''Kexi''' offers a generic name like '''Table1'''. To change the name, enter '''''Persons''''' into the '''Caption''' field and press the <keycap>Enter</keycap> key or click the <keycap>OK</keycap> button. The '''Caption''' field will be used to display the table to database end-users, e.g. as a form. Unlike the name, the caption can contain any characters including spaces and special characters.  
# As the design is not yet saved in the database, the Save Object As dialog window appears. You need to specify the name for the new table.  


Kexi offers a generic name like Table1. To change the name, enter Persons into the Caption field and press the Enter key or click the OK button. The Caption field will be used to display the table to database end-users, e.g. as a form. Unlike the name, the caption can contain any characters including spaces and special characters.  
Note that filling the '''Caption''' field automatically fills the Name field. For your convenience the rule for using only letters, numbers and the "_" character is kept. You can alter the contents of the Name field if you want to.  


Note that filling the Caption field automatically fills the Name field. For your convenience the rule for using only letters, numbers and the "_" character is kept. You can alter the contents of the Name field if you want to.  
# You are asked about an agreement for automatic adding of primary key to the table. Click <menuchoice>Add primary key</menuchoice> button to continue.
# The '''Persons''' table has been created and opened in '''Data View'''. Its name appears in the '''Project Navigator''' pane.  
# Create the '''''phone_numbers''''' table, in a similar way as persons table.
# Create a person field of type '''Integer''' number and phone of type '''Text'''. Do not use a number type here because phone numbers can have many different forms and prefixes.  
# Click <menuchoice>Switch to data view</menuchoice> button on the toolbar and enter '''''Phones''''' caption for the table. As for your previous table, allow '''Kexi''' to automatically create a primary key.


# You are asked about an agreement for automatic adding of primary key to the table. Click Add primary key button to continue.
[[Category:Kexi]]
# The Persons table has been created and opened in Data View. Its name appears in the Project Navigator pane.
[[Category:Tutorials]]
# Create the phone_numbers table, in a similar way as persons table.
</translate>
# Create a person field of type Integer number and phone of type Text. Do not use a number type here because phone numbers can have many different forms and prefixes.
# Click Switch to data view button on the toolbar and enter Phones caption for the table. As for your previous table, allow Kexi to automatically create a primary key.

Revision as of 13:36, 19 October 2011

Other languages:

The Table Designer window

Table Designer window consists of following columns:

  • PK - Primary Key.
  • Field Caption - caption of the field which will be displayed during data entering.
  • Data Type - a combo box containing a list of data types, allowing to set a main rule for entered data for a given field. For example, when an integer number data type is set for a field, a database user will not able to enter letter characters into this field.
  • Comments - you can enter here any information useful for understanding what the given field is provided for. This additional text will be saved within the table design and only visible in design mode.

In the Table designer window, every row corresponds to a single table field. You can recognize you are in design mode because the Switch to design view button is toggled on within the main Kexi toolbar.

Procedure 3.3. Designing the Persons table

  1. In the first row click on the cell in the Field Caption column and enter Name as field caption.

Notes about field names and captions

  • Every table field must have a name and a caption, these cannot be empty.
  • Field name is a word used by the database, usually not visible for users of the database application. The name may not contain special (national) characters (like ±, ¶, Ü) or space characters. The name must only contain roman letters, numbers and underscore sign "_". Use the latter instead of spaces or dashes.
  • Field names must be started with a letter or underscore sign "_", never with a number.
  • It does not matter whether you are using small or capital letters. For Kexi the database name Persons is the same as persons.
  • Field caption, on the other hand, allows you to enter any letters and special characters. It will be displayed for users of the database application.
  1. In a similar way, enter the following fields into the table design:
  • surname
  • street
  • house_number
  • city
  1. All the above fields, except house_number, are of type text. Change house_number field's type to integer number. To do this, click on a cell in the Data Type column, house_number row and then click on drop down list's button (you can also press F4 or Alt+Down. The list of data types will appear. Select the Integer number type.

From now on, the house_number field only accepts numbers.

  1. Persons table design is ready. Click Switch to data view button on the toolbar to finish designing and switch to Data View for the table. This allows you entering data into the table.
  2. As the design is not yet saved in the database, the Save Object As dialog window appears. You need to specify the name for the new table.

Kexi offers a generic name like Table1. To change the name, enter Persons into the Caption field and press the Enter key or click the OK button. The Caption field will be used to display the table to database end-users, e.g. as a form. Unlike the name, the caption can contain any characters including spaces and special characters.

Note that filling the Caption field automatically fills the Name field. For your convenience the rule for using only letters, numbers and the "_" character is kept. You can alter the contents of the Name field if you want to.

  1. You are asked about an agreement for automatic adding of primary key to the table. Click Add primary key button to continue.
  2. The Persons table has been created and opened in Data View. Its name appears in the Project Navigator pane.
  3. Create the phone_numbers table, in a similar way as persons table.
  4. Create a person field of type Integer number and phone of type Text. Do not use a number type here because phone numbers can have many different forms and prefixes.
  5. Click Switch to data view button on the toolbar and enter Phones caption for the table. As for your previous table, allow Kexi to automatically create a primary key.