Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » MobiLink - Getting Started » MobiLink tutorials » Tutorial: Introducing MobiLink

 

Lesson 2: Creating and populating a table in the MobiLink consolidated database

In this lesson, you create the Product table and insert sample data in the MobiLink consolidated database.

Prerequisites

This lesson assumes you have completed all preceding lessons. See Lesson 1: Setting up a MobiLink consolidated database.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Introducing MobiLink.

 Task
  1. Connect to the consolidated database in Interactive SQL. At a command prompt, run the following command:

    You can start Interactive SQL from Sybase Central or at a command prompt.

    • From Sybase Central, right-click the MLconsolidated - DBA database and click Open Interactive SQL.

    • dbisql -c "DSN=mlintro_consdb"
  2. Execute the following SQL statement in Interactive SQL to create the Product table:

    CREATE TABLE Product (
    name VARCHAR(128) NOT NULL PRIMARY KEY,
    quantity INTEGER
    );

    The Product table contains the following columns:

    Column Description

    name

    The name of the product.

    quantity

    The number of items sold.

    After creating the tables, you populate the Product table with sample data.

  3. Execute the following SQL statements in Interactive SQL to populate the Product table with sample data:



    INSERT INTO Product(name, quantity)
        VALUES ( 'Screwmaster Drill', 10);
    
    INSERT INTO Product(name, quantity)
        VALUES ( 'Drywall Screws 10lb', 30);
    
    INSERT INTO Product(name, quantity)
        VALUES ( 'Putty Knife x25', 12);
    
    COMMIT;
  4. Verify that the Product table contains the data inserted from the previous step.

    Execute the following SQL statement to verify the contents:

    SELECT * FROM Product

    The contents of the Product table should appear in Interactive SQL.

  5. Close Interactive SQL. You do not need to save your SQL statements.

Results

The Products table is created in the consolidated database.

 See also