Difference between revisions of "Documentation/AOO4 ser Guides/Getting Started/Getting Started with Base/Creating Database Tables/Creating Tables in Design View"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Replaced content with "{{delete| Wrong namespace, good page is already in place}}")
 
Line 1: Line 1:
{{DISPLAYTITLE:Creating Tables in Design View}}
+
{{delete| Wrong namespace, good page is already in place}}
{{Documentation/GS4BaseTOC
+
|ShowPrevNext=block
+
|PrevPage=Documentation/AOO4_User_Guides/Getting Started/Getting Started with Base/Creating Database Tables/ Creating a Table by Copying an Existing Table
+
|NextPage=Documentation/AOO4 User Guides/Getting Started/Getting Started with Base/Creating Database Tables/Creating Auxiliary Tables for Data Entry
+
}}
+
__NOTOC__
+
 
+
=== Creating Tables in Design View ===
+
Design View is a more flexible method for creating a new table, in which you directly enter information about each field in the table. We will use this method for the rest of the tables of our database.
+
 
+
{{Note| While the Field type and formatting are different in Design View, the concepts are the same as in the Wizard.}}
+
 
+
The first table to be created is ''People''. Its fields are ''PeopleID, FirstName, ''and'' LastName''.
+
 
+
# Click Create Table in Design View. A table similar to Figure 163 will appear but with no entries.
+
# ''PeopleID'' field:
+
#* Type ''PeopleID'' as the first Field Name. Press the {{key|Tab}} key to move to the Field Type column.
+
#* Select ''Integer [INTEGER]'' as the Field Type from the dropdown list. (The default setting is Text [VARCHAR].)
+
{{Tip| A shortcut for selecting from the Field Type dropdown list: press the key for the first letter of the choice. You can cycle through the choices for a given letter by repeatedly pressing that key.}}
+
** Change the Field Properties in the bottom section<br />Change ''AutoValue'' from ''No'' to ''Yes.''
+
** As a result of choosing AutoValue, when you move the cursor to the next row, ''PeopleID'' will be set as the ''Primary key'' and a small key icon will appear next to the field name. To set the primary key manually, right-click on the green triangle to the left of the field name (Figure 163) and select ''Primary Key'' from the menu. This places a key icon in front of the field name. However, if AutoValue has not been set, you will need a method to track what values have been used and to create values for new entries.
+
 
+
[[Image:AOO41GS8_004.png|400px|center]]
+
<center>''Figure 163: Table definition after the first row is defined''</center>
+
 
+
# FirstName and LastName fields:
+
#* Type the next field name in the Field Name column.
+
#* Select the Field Type ''TEXT [VARCHAR]'' for each field.
+
# To save and close the table, choose {{menu|File|Save}}. Name the table ''People''. Close the table.
+
 
+
Follow the same steps to create a table named ''Sales''. The fields and their field types are listed in Figure 164. Make sure you make the ''SaleID'' field the primary key before closing. This should be true if you define the field with AutoValue = Yes. Be sure to set the ''Decimal places ''of the ''Amount'' field to 2 as shown in the figure.
+
 
+
You can set the display format of either the ''Date ''field or the ''Amount'' field. To do this, click the button at the right end of the ''Format example'' box to bring up the ''Field Format'' dialog. This dialog is shown in Figure 165 with a currency format chosen, which might be appropriate for the ''Amount'' field.
+
 
+
Once all the fields are defined, save the table and name it ''Sales''. Close the Sales table and save the Base document.
+
 
+
[[Image:AOO41GS8_005.png|400px|center]]
+
<center>''Figure 164: Fields in Sales table''</center><br />
+
[[Image:AOO41GS8_006.png|400px|center]]
+
<center>''Figure 165: Field Format dialog''</center>
+
 
+
{{CCBY}}
+
[[Category:Getting Started (Documentation)]]
+

Latest revision as of 14:00, 23 September 2023

Personal tools