summaryrefslogtreecommitdiff
path: root/src/help/studio_help/src/topics/t_db-table-creating.dita
blob: 757d7afc862bc50344b44182cdb62b18246dc2c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "../dtd/task.dtd">
<task id="t_db-table-creating" xml:lang="en-us">
  <title>Creating a database table</title>
  <shortdesc>From the MOTODEV Database Explorer view you can create new tables within SQLite databases.</shortdesc>
  <prolog>
    <metadata>
      <keywords>
        <!--<indexterm></indexterm>-->
      </keywords>
    </metadata>
  </prolog>
  <taskbody>
    <prereq>You perform this task from within the MOTODEV Database Explorer view. This view is part of the MOTODEV
      Database perspective; switch to this perspective when working with Android databases.</prereq>
    <steps>
      <step>
        <cmd>Ensure that you are connected to the database.</cmd>
      </step>
      <step>
        <cmd>Right-click the connected database file and select <uicontrol>Create Table</uicontrol> from the menu that
          appears.</cmd>
        <stepresult>The Create New Table dialog appears.</stepresult>
      </step>
      <step>
        <cmd>Supply a name for the new table using the <uicontrol>Table Name</uicontrol> field.</cmd>
      </step>
      <step>
        <cmd>Add columns to your table (you must create at least one). For each:</cmd>
        <substeps>
          <substep>
            <cmd>Click <uicontrol>Add</uicontrol>.</cmd>
            <stepresult>The Add/Edit Field dialog appears</stepresult>
          </substep>
          <substep>
            <cmd>Supply a name for the table column using the <uicontrol>Name</uicontrol> field.</cmd>
          </substep>
          <substep>
            <cmd>If the column will contain a primary key, select <uicontrol>Primary key</uicontrol> and specify any
              automatic key behavior. </cmd>
          </substep>
          <substep>
            <cmd>Ensure that the column type is correct. If necessary, select a different type.</cmd>
          </substep>
          <substep>
            <cmd>If the table column should have a default value, specify it using the <uicontrol>Default
              Value</uicontrol> field.</cmd>
          </substep>
        </substeps>
      </step>
      <step>
        <cmd>Once you have specified all of the needed table columns, click <uicontrol>Finish</uicontrol> in the Create
          New Table dialog.</cmd>
      </step>
    </steps>
    <result> The table is created and added to the database. </result>
    <postreq>
      <note type="important">If you create the new table within a database on a connected device or running emulator,
        you may need to refresh the database (press F5, or right-click the database and select <uicontrol
        >Refresh</uicontrol>) in order for the change to be reflected on the device.</note>
    </postreq>
  </taskbody>
</task>