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. 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. You also have to be aware of different time zones and server time zone.
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.
Answer: This is more comprehensive SQL and database interview question. First of all we test if the candidate knows what an orphan is. An Orphan is a foreign key value in "child table" which doesnt exist in primary key column in parent table.
Adding distinct or count to select is common practise. In SQL Server you can also you except which will show all unique values from first query that don't exist in second query. First day of previous month First day of current month Last day of previous month Last day of current month Answer: These tasks require good grasp of SQL functions but also logical thinking which is one of the primary skills involved in solving sql questions.
In this case I provided links to actual answers with code samples. Experienced people should give correct answer almost immediately. People with less experience might need more time or would require some help Google. Question: You have a table that records website traffic. What would be the query to show all websites visited in the last 30 days with total number or visits, total. Answer: This test is mainly about good understanding of aggregate functions and date time.
In this we need to group by Website, Filter data using datediff but the trick in here is to use correct time zone. The next field should be in here but as it is more complicated I put it as third field. So I combined pagename with ipaddress to counted unique values.
Just to explain one page could receive 3 vists from 2 unique visits and another page could receive one visit from ip that visited previous page so Unique IP is 2, PageView is 3 1 visitor 2 pages and 1 visitor 1 page and visits is 4 Question: How to display top 5 employees with the higest number of sales total and display position as a field. Answer: Microsoft introduced in SQL Server ranking function and it is ideal to solve this query. Now that we covered basic and intermediate questions let's continue with more complicate ones.
These questions and answers are suitable for experienced candidates:. Answer: The word accurate is crucial here. The short answer is you have to play with several functions. There are several other ways to solve that but I found this way to be most efficient and simple. I must admit I didn't answer correctly this sql interview question a few years back. There is also table sample function but it is not truly random as it operates on pages not rows and it might not also return the number of rows you wanted.
Answer: The first question is actually what is a recursive query? The most common example is parent child hierarchy for instance employee hierarchy where employee can have only one manager and manager can have none or many employees reporting to it. Recursive query can be create in sql using stored procedure but you can also use CTE Common table expression. It might be also worth asking about performance as CTE is not always very fast but in this case I don't know which one is would perform betters.
I will try to find time to add more questions soon. Feel free to suggest new questions add comments. Hope that helps! Open navigation menu. Close suggestions Search Search. User Settings. Skip carousel. Carousel Previous. Carousel Next. What is Scribd? Did you find this document useful? Is this content inappropriate? Report this Document. Description: SQL. Flag for inappropriate content. Download now. Related titles. Carousel Previous Carousel Next. Jump to Page. Search inside document.
People doing SQL related Interviews face to face Recruiters trying to check the candidate's proficiency with SQL Candidates who can prepare better for the interview You won't get explicit answers here These questions are mainly small tasks where the candidate can present not only their SQL knowledge but analytical skills and relational database understanding. Jk nayak. Fatin Afiqah. Alok Kumar. Kishan Kumar Jha. Lella Anjaneyulu. Anonymous 1GAxwUf.
Pavani Perumalla. Ramu Yadav M. Download Free PDF. Sql interview questions and answers for freshers pdf. Gayatri Dv. A short summary of this paper. Download Download PDF. Translate PDF. Sql int erview quest ions and answ ers for freshers pdf What is sql?
Structured Query Language SQL is a language that provides an interface to relational database systems. The development of SQL is governed by standards. SQL3 support object extensions and are partially? Sql interview questions: 1. What operator performs pattern mat ching?
LIKE operator 3. What operator tests column for the absence of data? Which command executes the contents of a specified file? RUN 7. What are the w ildcards used for pattern matching? State true or false.
0コメント