Creating Table & Columns in SQL
In a database, the data is stored in the form of tables. In a table, there are couple of columns to store the data in an organized manner. One of the column in table is marked as Primary Key. Primary key is basically used to uniquely identify each record in a table.
There are various data types in SQL. Nvarchar is one of the data types. Each character stored in nvarchar column occupies 2 bytes. You can store up to 4000 Unicode/non-Unicode characters. It is basically used to store string and char. You can pass as parameter, the max number of characters you want to store. If you do not pass any number as parameter, then it will be considered as 1. Int data type is used to store integer values. Please Click Here for complete list of data types in SQL.
During column declaration, we are going to use NOT NULL constraint. This means that column should not accept null values.
We are going to create a table tblEmployee with 4 columns (ID, Name, Email, Gender). Syntax is given below:
Create Table tblEmployee
ID int NOT NULL Primary Key,