Learn SQL Database Table syntax
In this tutorial will learn Table in SQL Database, Here we learn database with a practical example.
So, just think of some business requirement, and you will learn how to develop SQL Table and manipulate data as per business requirement.
We want to create a SQL Table where all students’ data will be stored, so whenever a student joins this training course their Name, email, date of birth, contact number, joining date, address, and course complete date will be captured
CREATE TABLE [dbo].[tbStudent]( [studentId] [bigint] IDENTITY(1,1) NOT NULL, [FullName] [varchar](50) NOT NULL, [Address] [varchar](150) NULL, [email] [varchar](100) NULL, [contactnumber] [varchar](50) NULL, [DOB] [datetime] NULL, [updatedon] [datetime] NULL, [courseCompleteDate] [datetime] NULL, [joiningDate] [datetime] NULL, CONSTRAINT [PK_tbStudent] PRIMARY KEY CLUSTERED ( [studentId] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]
INSERT INTO [tbStudent] ([FullName] ,[Address] ,[email] ,[contactnumber] ,[DOB] ,[updatedon] ,[courseCompleteDate] ,[joiningDate]) VALUES ('Bill Zuckerberg' ,'Mumbai, India' ,'firstname.lastname@example.org' ,'9800000012' ,'09/10/1990' ,getdate() ,'10/10/2019' ,getdate())