Definition of Table:- A Table is an object Used to Store data in Rows and Columns Formate.A Single Table Stores information about a particular topic, Such as customers,products, or orders etc.
In Sql Server, Tables can be created graphically or using a query.
2.using a query
Expand Databases -> Expand Database(What ever you created) -> Right Click on Tables-> Select New Table…-> Give Columns Names in Column Name Column and Give Data Type to Appropriate Datatype to related column. If you Want to allow nulls then check Allow Nulls Column fields or else Uncheck Allow Nulls Column fields.
2. using a query:- We can also Create a Database using a Query, The SQL CREATE TABLE statement allows you to create and define a table.
1.Take New Query Window editor then
2. Write a query in that window
CREATE TABLE table_name
Parameters or Arguments
- table_name:- The name of the table that you wish to create.
- column_name1, column_name2, column_name3 :- The columns that you wish to create in the table. Each column must have a datatype. The column should either be defined as NULL or NOT NULL and if this value is left blank, the database assumes NULL as the default.
Let’s look at a SQL CREATE TABLE example.
CREATE TABLE Employee
( Employee_id int NOT NULL,
Employee_name char(50) NOT NULL,
This SQL CREATE TABLE example creates a table called Employee which has 3 columns.
- The first column is called Employee_id which is created as a number datatype (maximum 10 digits in length) and can not contain null values.
- The second column is called Employee_name which is a char datatype (50 maximum characters in length) and also can not contain null values.
- The third column is called contact_name which is a char datatype but can contain null values.
then Refresh the Databases Folder you will see Database name what ever you creates here you will see Database name Sample in Databases Folder.