© Belgium Campus 2021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

1

© BELGIUM CAMPUS 2021


2

© BELGIUM CAMPUS 2021


3

CREATE DATABASE Student


ON
(<FileSpec>)

LOG ON
(<FileSpec>)

Details about main Details about main Details about main


point 1. point 2. point 3.
4

CREATE DATABASE Student


ON
(NAME = StudentDataFile1,
FILENAME = ‘C:\MyFolder\date\ StudentDataFile1.mdf’)

LOG ON
(NAME = StudentLogFile1,
FILENAME = ‘C:\MyFolder\date\ StudentLogFile1.ldf’)

Details about main Details about main Details about main


point 1. point 2. point 3.
5

These words are reserved by SQL Server and have special functions.

The CREATE statement is used for ON is used to specify the PRIMARY is the optional keyword
any new object that will be number, name, and size of indicated that the list of files that
created in SQL Server. We always data files to use. follow belong to the primary
use CREATE OBJECTTYPE filegroup.
OBJECTNAME.
6

These words are reserved by SQL Server and have special functions.

LOG ON is the keyword used to <FileSpec> this is to show where NAME is the logical
specify the number, name, and the file properties will be filename that SQL uses
size of Log files to use. indicated. internally.
7

These words are reserved by SQL Server and have special functions.

FILENAME is the full path name for The File Path is in single quotes, The FILENAME also
the file to be created on the and there are commas between contains the file
server. The Folder structure MUST the File properties. Note that extension.
exist in order for the file to be there is no comma between the
created. DATAFILE and the LOG FILE.
8

CREATE DATABASE Student2


ON
(NAME = StudentDataFile1,
FILENAME = ‘C:\MyFolder2\data\ StudentDataFile1.mdf’,
Now Let us look at an SIZE = 5MB,
example that will contain MAXSIZE = UNLIMITED,
more Properties. FILEGROWTH = 10%)

LOG ON
(NAME = StudentLogFile1,
FILENAME = ‘C:\MyFolder2\data\ StudentLogFile1.ldf’,
SIZE = 5MB,
MAXSIZE = UNLIMITED,
Details about main Details about
FILEGROWTH = 10MB main Details about main
point 1. ) point 2. point 3.
9

These words are reserved by SQL Server and have special functions.

SIZE this is for the initial creation MAXSIZE is used to indicate the FILEGROWTH is used to indicate
size of a file. The size is followed maximum allowable size for the file. how much a file can grow each
by a KB or MB qualifier. The This is used when the file is filled and time it fills. It may be specified
Minimum size for a file is 512 KB. SQL attempts to auto-grow the file. A using KB, MB or %. The Number
set size may be given or UNLIMITED can not exceed the MAXSIZE
may be specified. parameter.
10

You now have the opportunity to


create your own Database.

Complete Physical Implementation


Exercise 1 Question 1.

© BELGIUM CAMPUS 2021


11

CREATE DATABASE Student3


ON
(NAME = StudentDataFile1,
FILENAME = ‘C:\MyFolder3\data\ StudentDataFile1.mdf’,
SIZE = 5MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10%),

FILEGROUP Secondary
(NAME = StudentDataFile2,
FILENAME = ‘C:\MyFolder3\data\ StudentDataFile2.ndf’,
Creating a Database with a
SIZE = 5MB,
secondary FileGroup.
MAXSIZE = UNLIMITED,
FILEGROWTH = 10%)

LOG ON
(NAME = StudentLogFile1,
FILENAME = ‘C:\MyFolder3\data\ StudentLogFile1.ldf’,
Details about main SIZE = 5MB, Details about main Details about main
point 1. MAXSIZE = UNLIMITED, point 2. point 3.
FILEGROWTH = 10MB)
12

Complete Question 2

© BELGIUM CAMPUS 2021

You might also like