SQL – Create Database/DB
A database contains all objects itself including meta data/log file and objects like function , triggers , stored procedures , views etc and can be restored on different machine.
Create Database NameOfDatabase
Create Database Item_Master
Note: – After executed the command refresh the objects.
Get the Files location of Database – SELECT Name, Physical_name as Dabase_FilePath FROM sys.master_files
Over View of SQL Database and files concept.
SQL – Database based on MDF File and LDF file group. When a database is created, SQL (default) creates two files MDF (Meta Data File) and LDF file (Log data file)
MDF – mdf file stores the object like – tables, stored procedures, views, triggers etc.
Log – it keeps the records of all the transactions is executed on database , it helps to recover the database in disaster recovery situation and can recover all the database if backed up of the logs.
Note – a database can have single MDF file and multiple NDF files and log files. (It is located in Files Group options ) , it is required to manage the storage of a database