Here I just created Employee table and on the basis of Write Some common query which generally asking in interview.
CREATE TABLE [dbo].[tblEmployee](
[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
[LastName] [nvarchar](20) NOT NULL,
[FirstName] [nvarchar](10) NOT NULL,
[Title] [nvarchar](30) NULL,
[BirthDate] [datetime] NULL,
[HireDate] [datetime] NULL,
[Address] [nvarchar](60) NULL,
[City] [nvarchar](15) NULL,
[Country] [nvarchar](15) NULL
)
GO
1. Ques: List of all employee from tblEmployee table whose "FirstName" start with latter 'a'.
Answer: SELECT * FROM [tblEmployee] WHERE FirstName like 'a%'
CREATE TABLE [dbo].[tblEmployee](
[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
[LastName] [nvarchar](20) NOT NULL,
[FirstName] [nvarchar](10) NOT NULL,
[Title] [nvarchar](30) NULL,
[BirthDate] [datetime] NULL,
[HireDate] [datetime] NULL,
[Address] [nvarchar](60) NULL,
[City] [nvarchar](15) NULL,
[Country] [nvarchar](15) NULL
)
GO
SELECT * FROM [tblEmployee]
1. Ques: List of all employee from tblEmployee table whose "FirstName" start with latter 'a'.
Answer: SELECT * FROM [tblEmployee] WHERE FirstName like 'a%'
2. Ques: List of all employee from tblEmployee table whose "FirstName" start with any single character between 'a-j'.
No comments:
Post a Comment
Thank you for comment