How To Create Database And Table In Mssql

in #database6 years ago

 Hello Friend Today In This Blog I Will Show You How To Create Database And Table In Mssql.The CREATE DATABASE statement is used to create a new SQL database.The CREATE TABLE statement is used to create a new SQL table.The CREATE DATABASE statement must run in autocommit mode (the default transaction management mode) and is not allowed in an explicit or implicit transaction.Requires CREATE DATABASE permission in the master database, or requires CREATE ANY DATABASE, or ALTER ANY DATABASE permission.To maintain control over disk use on an instance of SQL Server, permission to create databases is typically limited to a few login accounts.The SQL CREATE DATABASE statement is used to create a new SQL database.Make sure you have the admin privilege before creating any database.A “Database” in SQL Server is a container that holds a group of related objects. In addition to storing the actual data, a Database also stores the structure of how that data is saved (called a Table), and any related helper objects such a Queries (saved ways to look data up). To begin, we’ll create a Database using the graphical interface called the “SQL Server Management Studio”.From the Windows Start Menu, select “Microsoft SQL Server”, and then “SQL Server Management Studio”. Once the Management Studio starts, right click the Databases folder and select new Database. Enter a name in the “Database name” text box. For this example, well use the name “Test”.As you the type the database name in, the Logical Name for the file types Data and Log will automatically fill in as well. The “Data” file is where the actual data is saved on the hard drive. The “Log” file keeps track of any changes to that data. Click OK.Now that the Database is created, a structure to hold the actual data is needed. This structure is called a Table. Think of Tables as containing Columns and Rows, like a spreadsheet.The CREATE TABLE statement is used to create a new table in a database.
To create a new table, enter the keywords create table followed by the table name, followed by an open parenthesis, followed by the first column name, followed by the data type for that column, followed by any optional constraints, and followed by a closing parenthesis. It is important to make sure you use an open parenthesis before the beginning table, and a closing parenthesis after the end of the last column definition. Make sure you seperate each column definition with a comma. All SQL statements should end with a ";".The table and column names must start with a letter and can be followed by letters, numbers, or underscores - not to exceed a total of 30 characters in length. Do not use any SQL reserved keywords as names for tables or column names (such as "select", "create", "insert", etc).Data types specify what the type of data can be for that particular column. If a column called "Last_Name", is to be used to hold names, then that particular column should have a "varchar" (variable-length character) data type.Creating a basic table involves naming the table and defining its columns and each column's data type.

Syntax
CREATE DATABASE databasename;

Syntax
CREATE TABLE table_name (    column1 datatype,    column2 datatype,    column3 datatype,   ....);
Step 1 :Create database
Create database BMC



Step 2:Create table
Here In This step We Will Create table.

Here In This Step We Required Four Column With Name Cids ,Cname ,Ccity And CPrice using Parameter bigint,varchar and float.
create table Client_table_news(Cids bigint,Cname varchar(50),Ccity varchar(200),CPrice float);


Here Is An Video Related To Topic In This blog Below,You Will Clear All The doubt Related To Topic Above.This Two Video Will Be Helpful To You,To Understand The Topic In This Blog.

HOW TO CREATE DATABASE USING SQL SERVER MANAGEMENT STUDIO



HOW TO CREATE DATABASE IN SQL MANAGEMENT STUDIO IN EASY WAY


 

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 60274.16
ETH 2339.61
USDT 1.00
SBD 2.55