After creating a database in SQL Server Now it is time to create a table.
Scenario
Create a table that stores basic information about a user that can log in to an application the followings are the columns or fields needed in that table.
Field Name | Data Type | Description |
userId | varchar(50) | it stores user id information, it is unique and also primary key |
userPwd | varchar(50) | it stores user password |
userName | varchar(50) | it stores user name |
userPhone | varchar(50) | it stores user phone |
userEmail | varchar(50) | it stores user Email |
userStatus | bit | it stores user status either true or false |
Solution
There are two ways to solve this problem. It can be either graphically or through code.
Create table using GUI in SQL Server Management Studio
- Start SQL Server Management Studio
- Expand the database name codemodes
- Right click on the tables click on Table
- And fill like the following

Now set the userId as primary key: Right-click on the row and click on Set Primary key

Now save the changes and name the table as user
Support us by sharing this post