Skip to content

Create Database

Mathias Rangel Wulff edited this page Jul 29, 2016 · 6 revisions

Keyword CREATE DATABASE

Syntax:

    CREATE [engineid] DATABASE databaseid;

To create AlaSQL 'native' database:

    alasql('CREATE DATABASE mybase');

External Databases

To create external (localStorage on IndexedDB) database:

    alasql('CREATE LOCALSTORAGE DATABASE lsbase');

When you create external database, you need to attach database before usage:

    alasql('CREATE INDEXEDDB DATABASE ixbase');
    alasql('ATTACH INDEXEDDB DATABASE ixbase AS myixdb');

JavaScript Functions for Opening Databases

To create new database:

	alasql('CREATE DATABASE [My Database]');

	// or

	var mydb = new alasql.Database();

	// or

	var mydb = new alasql.Database('My Database');

You can find database:

	var mydb = alasql.Database('My Database');

	// or

	var mydb = alasql.databases['My Database'];

See also: [DROP DATABASE](Drop Database)

Clone this wiki locally