Add a column to a database table using ALTER TABLE. - Android Database

Android examples for Database:Table Column

Description

Add a column to a database table using ALTER TABLE.

Demo Code


//package com.book2s;

public class Main {
    /**//  www.  ja va2s.co  m
     * Add a column to a table using ALTER TABLE.
     * 
     * @param dbTable name of the table
     * @param columnName name of the column to add
     * @param columnDefinition SQL for the column definition
     */
    public static String addColumnSql(String dbTable, String columnName,
            String columnDefinition) {
        return "ALTER TABLE " + dbTable + " ADD COLUMN " + columnName + " "
                + columnDefinition;
    }
}

Related Tutorials