TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nepethya Rana
NA
335
152.8k
How to store same name when name column is PK
Aug 27 2016 1:41 PM
In one of interview i have been asked this question.
1) The database fails to store 2 employees that have the same name. Do not sacrifice the usage of the primary key index seek for searching by name.
How can i solve this problem?
CREATE TABLE dbo.employees
(
uniqueEmployeesId int NOT NULL IDENTITY (1, 1),
name varchar(10) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL,
CONSTRAINT PK_employees PRIMARY KEY CLUSTERED ( name )
)
In this same schema there is another question
2) The search is failing to find employees with names longer than 10 characters.
foreach (string name in namesToSearch)
{
nameParam = name;
//search for employees by name
queries.Add(from e in context.employees
where e.name == nameParam
select e);
}
Reply
Answers (
2
)
How to attach sql express 2014 .mdf file in install Shield
Does DGV TextBoxColumn has text changed event handler?