Cyber Monday Deal : Flat 30% OFF! + free self-paced courses - SCHEDULE CALL
A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database management system (DBMS) typically controls a database. Any kind of data can be stored, updated, and accessed through databases. They gather data about people, places, and things. That information is gathered in one place to be observed and analyzed. Databases are an organized collection of information.We will learn the various syntaxes for creating an SQL database and how to access it in the following paragraphs. We will also discuss SQL Server create database microsoft sql server and MySQL Create database syntax.
The most widely used programming language for extracting and organizing relational database data is SQL. A database is a table that consists of rows and columns. SQL is the language of databases. It facilitates retrieving specific information from databases that are further used for analysis.Over the next few paragraphs, we will learn about different ways of creating an SQL database and how to access it. Data is an integral part of businesses, and there’s great demand for administrators. Therefore go through the SQL DBA career path if you too want to set yourself up for this role. We will also learn about the different syntaxes to create an SQL Server database and learn how to call a database.
The Primary Applications of Databases are as Follows:
There are mainly three ways to create an SQL Database
The screenshot for the SQL Server Management Studio looks like below.
Following are the steps to create a database using SQL Server Management Studio
1) Log in to SQL Server Management Studio.
2) Following Screen Appears
3) Select Database and Right-Click on it.
4) The Following Screen Appears.
5) Provide The Name of The Database and Click ok
6) Database is Created as Below
This is how you create a normal database in SQL Server. If you want to add some additional features to the database you can do so by following
Follow Till Step 5 and Go to Options
To add more filegroups, click the Filegroups option. Click Add, and then enter the values for the filegroup.
The syntax for creating a database using transacts SQL is as follows.
Create Database Databasename
[ ON [ PRIMARY ][...n ] [, [...n ] ] [ LOG ON [...n ] ] ] [ COLLATE collation_name ] [ WITH
Following are the steps by step how to create a database using transact SQL.
1) Log in to SQL Server Management Studio.
2) Click on The New Query Button.
3) The Screen Looks Like Below
4) If You Want to Create a Simple Database, The Syntax is as Below
Create Database Testdatabase for Blog
and click on execute
5) If The Syntax is ok, Then The Database is Created With The Following Message
6) The Database is Created as Below.
If you want to add some additional features to your database through transacting SQL following is the syntax to do it.
Create DataBase Test Database For Blog
ON (NAME = testdatabaseforblog_dat, --logical datafile name FILENAME = 'D:\DATA\ testdatabaseforblog. mdf', --physical datafile name SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5) LOG ON (NAME = testdatabaseforblog_log, --logical logfile name FILENAME = 'D:\DATA\ testdatabaseforblog log. ldf', --physical logfile name SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB ); GO
There is a third way how you can create a database. This is through the command prompt. Below is how you evoke the command prompt.
1) Type CMD in The Windows Search Bar to Invoke The Command Prompt.
2) Following Screen Appears
3) Type sqlcmd against the command prompt and press enter. The command prompt changes to 1>
Now let us understand step by step how to create a database using the command prompt. The syntax for creating a database using a command prompt is as follows.
Create Database Database Name
[ ON [ PRIMARY ][...n ] [, [...n ] ] [ LOG ON [...n ] ] ] [ COLLATE collation_name ] [ WITH
For creating an authoritative database using the command prompt following is the syntax
create database testdatabaseforblog made the database will be created.
If you want to add some addition, al features to your database you can use the following syntax
Create Database Test Database for Blog
ON (NAME = testdatabaseforblog_dat, --logical datafile name FILENAME = 'D:\DATA\ testdatabaseforblog. mdf', --physical datafile name SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5) LOG ON (NAME = testdatabaseforblog_log, --logical logfile name FILENAME = 'D:\DATA\ testdatabaseforblog log. ldf', --physical logfile name SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB ); GO
The Screenshot Looks Like Below
We have learned to create SQL database using three different techniques. Next, we will learn how to use the database.
Once you have created a database, you just need to select the database name from the top to activate the database.
From transact SQL, you need to use the following SQL query to activate your database.
Use [testdatabaseforblog] go. Using Command Prompt use [testdatabaseforblog] go.
Following is The Screenshot.
We have learned how to create a database and also how to use a database. Finally, we will learn how to delete a database.
Right click on the database that needs to be deleted and click on delete. The database will be deleted.
1) Log on to SQL Server Management Studio
2) Select a database other than the database to be deleted.
3) On the query window, type in the following command.
Go to SQL command prompt from the Dos window.
Type the following command
drop database [testdatabaseforblog] go. The database will be deleted.
Over the last few paragraphs, we learned about databases and their use. We have also known different ways to create a database in SQL Server. We have learned how to use a database and delete an existing database if it is no longer in user. I hope this will give a fair bit of idea to the readers about the basics of SQL server database creation, or to learn more you can enroll to online sql server training.
SQL Testing Training
What is Schema in SQL With Example: All You Need to Know
Data Definition Language (DDL) Commands in SQL
How To Create Database Table-All You Need To know
What does a Database Administrator do? A Detailed Study
Cyber Security
QA
Salesforce
Business Analyst
MS SQL Server
Data Science
DevOps
Hadoop
Python
Artificial Intelligence
Machine Learning
Tableau
Download Syllabus
Get Complete Course Syllabus
Enroll For Demo Class
It will take less than a minute
Tutorials
Interviews
You must be logged in to post a comment