Question: What type of joins have you used?
Answer: Joins
knowledge is MUST HAVE. This interview question is quite nice because most
people used inner join and (left/right) outer join which is rather mandatory
knowledge but those more experienced will also mention cross join and self-join.
In SQL Server you can also get full outer join.
Question: How can you
combine two tables/views together? For instance one table contains 100 rows and
the other one contains 200 rows, have exactly the same fields and you want to
show a query with all data (300 rows). This sql interview question can get
complicated.
Answer: You use UNION operator. You can drill
down this question and ask what is the different between UNION and UNION ALL
(the first one removes duplicates (not always desirable)… in other words shows
only DISTINCT rows….Union ALL just combines so it is also faster). More tricky
question are how to sort the view (you use order by at the last query), how to
name fields so they appear in query results/view schema (first query field names
are used). How to filter groups when you use union using SQL (you would create
separate query or use common table expression (CTE) or use unions in from with
().
Question: What is the difference between where and having
clause?
Answer: in SQL Where filters data on lowest row level.
Having filters data after group by has been performed so it filters on
"groups"
Question: How would apply date range
filter?
Answer: This is tricky question. You can use simple
condition >= and <= or similar or use between/and but the trick is to know
your exact data type. Sometimes date fields contain time and that is where the
query can go wrong so it is recommended to use some date related functions to
remove the time issue. In SQL Server common function to do that is datediff
function. You also have to be aware of different time zones and server time
zone.
Question: What type of wildcards have you used? This is usually
one of mandatory sql interview question.
Answer: First
question is what is a wildcard? Wildcards are special characters that allow
matching string without having exact match. In simple word they work like
contains or begins with. Wildcard characters are software specific and in SQL
Server we have % which represent any groups of characters, _ that represent one
character (any) and you also get [] where we can [ab] which means characters
with letter a or b in a specific place.
Top job interview materials
1. Ultimate Guide to Job Interview Answers
Word-for-Word Job Interview Answers to Use To Get Hired, Dow...
This ebook includes top 10 secrets that help you will every job interview...nload 177 Proven Answers to Job Interview Questions
Thứ Tư, 7 tháng 11, 2012
SQL Basic Interview questions
Top job interview materials
1. Ultimate Guide to Job Interview Answers
Word-for-Word Job Interview Answers to Use To Get Hired, Download 177 Proven Answers to Job Interview Questions...
2. Killer Interview Secrets E-book
This ebook includes top 10 secrets that help you will every job interview...
3. Free ebook: 75 interview questions and answers
This ebook includes: 75 interview questions and answers, types of job interview questions and how to face them, interview tips...
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét