SQL Beginner's Guide

1. Database files (3)

1. The main database file    file extension .mdf

2. Secondary database file    file extension .ndf

3. Transaction log    file extension .ldf

Second, the code to create the database

 creat database myschool  --creat create stuff

 on  primary

   (

/* Properties of the main data file */

name='myschool_data',  -- the logical name of the main data file

filename='e:\mycool_data.mdf',   -- the physical path of the main data file

size=5mb, -- the initial size of the main data file

maxsize=100mb,   -- the maximum value of the main data file

filegrowth=15%   -- the growth rate of the main data file , the last sentence does not add a comma

     ),    -- the comma between the primary database and the secondary database cannot be lost

 (

/* Attributes of the secondary data file */

name='myschool_data2',   -- the logical name of the secondary data file

filename='e:\mycool_data2.ndf',    -- the physical path of the secondary data file

size=8mb, -- the initial size of the secondary data file

maxsize=100mb,    -- the maximum value of the secondary data file

filegrowth=10%    -- the growth rate of the secondary data file , the last sentence does not add a comma

     )


log on

(

/* Attributes of the log file */

name='myschool_log',   -- the logical name of the log file

filename='e:\mycool_log.ldf',    -- the physical path of the log file

size=2mb,   -- initial size of log file

filegrowth=2mb,    -- the growth rate of the log file , the last sentence does not add a comma

)

Go


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325715196&siteId=291194637