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

From KDE UserBase Wiki
(Importing a new version from external source)
(Importing a new version from external source)
Line 38: Line 38:
* '''''Husnummer'''''
* '''''Husnummer'''''


* '''''city'''''
* '''''By'''''


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 or press <keycap>F4</keycap>. You can also use the arrow keys <keycap>Up</keycap> and <keycap>Down</keycap> to select another type. The list of data types will appear. Select the '''Integer''' 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 or press <keycap>F4</keycap>. You can also use the arrow keys <keycap>Up</keycap> and <keycap>Down</keycap> to select another type. The list of data types will appear. Select the '''Integer''' type.  

Revision as of 12:14, 14 April 2012

Other languages:

Tabeldesign-visningen

Tabeldesignervinduet består af følgende søjler:
  • Informationsikonet — Yderligere information om feltet.
  • Feltpåskrift — feltets titel, som vil blive vist under dataindtastning.
  • Datatype — en comboboks, som indeholder en liste af datatyper; den lader dig angive en hovedregel for data, som kan angives i et givet felt. Når et felts datatype for eksempel er sat til heltal, så kan en bruger af databasen ikke skrive bogstaver i dette felt.
  • Kommentar — her kan du skrive hvad som helst, der kan være nyttigt for at forstå hvad et givet felt er til for. Denne ekstra tekst vil blive gemt i tabeldesignet og vises kun i designtilstand.

I tabeldesignerens vindue svarer hver række til et enkelt felt i tabellen. Du kan se at du befinder dig i designtilstand fordi knappen Design er trykket ned i tabeldesignervinduets værktøjslinje.

Design af tabellen Personer

I den første række klikker du på cellen i søjlen Feltpåskrift og skriver Navn som feltets titel.

Noter om feltnavne og titler

  • Enhver tabel skal have et navn og en titel; disse kan ikke være tomme.
  • Feltnavnet er et ord, som bruges af databasen og som i reglen ikke kan ses af brugerne af databaseprogrammet. Navnet kan ikke indeholde specielle tegn (som ±, ¶, Ü) eller blanktegn. Navnet kan kun indeholde bogstaver fra det engelske alfabet, cifre og understregningstegnet "_" — brug dette i stedet for mellemrum og bindestreger.
  • Feltnavne skal begynde med et bogstav eller understregningstegnet "_", aldrig med et ciffer.
  • Det gør ingen forskel om du bruger store eller små bogstaver. For Kexi er feltnavnet Personer det samme som personer.
  • Felttitler kan derimod indeholde alle slags bogstaver og specielle tegn. Det vil blive vist til databaseprogrammets brugere.

På tilsvarende måde udfyldes følgende felter i tabeldesignet:

  • Efternavn
  • Gade
  • Husnummer
  • By

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 or press F4. You can also use the arrow keys Up and Down to select another type. The list of data types will appear. Select the Integer type.

From now on, the house_number field only accepts numbers.

Persons table design is ready. Click the Data button on the toolbar to finish designing and switch to Data View for the table. This allows you to enter 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.

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 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 the Data button on the toolbar and enter Phones caption for the table. As for your previous table, allow Kexi to automatically create a primary key.