The basic building block of storing
data in SQL Server Database is a “Table”
aka “Relation”. It’s a collection of rows and columns grouped together.
Ø Rows in a table are aka Tuples, Records.
Ø Columns in a table are aka Fields, Attributes, Columns.
The following figure clearly explains
the terminology:
We can see that the above figure
represents a Relation / Table named “DEPT”
and it has got fields like “Deptno”, “Dname” etc.
The following command is used to create
a table:
Create Table Dept
(
Deptno numeric(10),
Dname varchar(100),
Loc varchar(100)
)
We are creating a table with 3 columns.
And two columns have “varchar” datatype and Deptno has got “numeric” datatype.
DataType means what kind of Data we can store in that field. Numeric as name
suggests can store numbers and Varchar can store alphanumeric.
We will have more on DataTypes in the coming
posts for different data types in SQL Server.
So we have created our first table in
SQL Server.
Stay tuned for more.!!!
Comments