SQL Tutorial - Create Database


'Create DB' command creates a new database in your SQL server.

Create Database


The 'Create Database' command creates the database, data files and transaction logs automatically in the default location unless specified. You can use the new query window of the SQL Managament studio to do this.

SQL 'Create DB' Syntax


CREATE DATABASE database_name

The Create Database Example


USE master
GO
CREATE DATABASE CompanyPayroll
ON
( NAME = CompanyPayroll_dat,
FILENAME = 'd:microsoft sql server\mssql\data\CompanyPayroll.mdf',
LOG ON
( NAME = 'CompanyPayroll_log',
FILENAME = 'd:microsoft sql server\mssql\data\CompanyPayroll.ldf',
GO