Basic SQL Interview Questions
Question: What type of joins have you used?
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.
Question: What is the difference between where and having clause?
Question: How would apply date range filter?
Question: What type of wildcards have you used? This is usually one of mandatory sql interview question.
Question: How do you find orphans?
Question: How would you solve the following sql queries using today's date?
First day of previous month
First day of current month
Last day of previous month
Last day of current month
Question: You have a table that records website traffic. The table contains website name (multiple websites), page name, IP address and UTC date time. What would be the query to show all websites visited in the last 30 days with total number or visits, total number if unique page view and total number of unique visitors (using IP Address)?
Question: How to display top 5 employees with the higest number of sales (total) and display position as a field. Note that if both of employees have the same total sales values they should receive the same position, in other words Top 5 employees might return more than 5 employees.
Question: How to get accurate age of an employee using SQL?
Question: This is SQL Server interview question. You have three fields ID, Date and Total. Your table contains multiple rows for the same day which is valid data however for reporting purpose you need to show only one row per day. The row with the highest ID per day should be returned the rest should be hidden from users (not returned).
Question: How to return truly random data from a table? Let say top 100 random rows?
Question: How to create recursive query in SQL Server?
Questions:
- What does SQL Stands for?
- What does T-SQL Stands for? *
- What is the difference between SQL and T-SQL? *
- Name all SQL Clauses.
- What is the order in which you need to use SQL Clause?
- Describe briefly all SQL Clauses
- What is the difference between WHERE and HAVING?
- What is a wildcard?
- How would you join multiple tables together in a query?
- Name all joins type you know.
- Describe each join type.
- What is a subquery?
- What is a derived table?
- What is an aggregate function?
- What are the rules when you want to use aggregate functions?
- What is the difference between deterministic vs non-deterministic functions?
- How are NULLs handled in aggregate functions? *
-
How to use aggregate function with unique list of values? *
- For instance count orders and count unique customers
- Describe all types of aggregate functions you know.
0 comments:
Post a Comment