Question 1: Primary Key vs Unique Key
What is the difference between primary key and unique key?
Question 2: NULL Data Type Handling
How do different data types handle NULL values?
Question 3: UPDATE with vs without WHERE
What happens when you use UPDATE command without WHERE clause?
Question 4: GROUP BY with Multiple Columns
How does GROUP BY work with multiple columns?
Question 5: SELECT with Pattern Matching and NULL Handling
From a customers table (customer_id, first_name, last_name, email, phone), find all customers whose email ends with '@gmail.com' and phone number is not NULL, showing only first_name and email.
Question 6: Composite Index Usage
What is a composite index and when should it be used?
Question 7: LIKE Wildcard Characters
What are the standard wildcard characters used with LIKE operator?
Question 8: INNER JOIN Syntax Requirements
What is required in INNER JOIN syntax?
Question 9: RIGHT JOIN Functionality
How does RIGHT JOIN work in SQL?
Question 10: MIN and MAX Functions with Date Operations
From an orders table (order_id, customer_id, order_date, total_amount), find the earliest order date, latest order date, lowest order amount, and highest order amount for each customer.
Question 11: Sorting Results
Which query returns student names in ascending order?
Question 12: ENUM Data Type Usage
What is ENUM data type and when should it be used?
Question 13: Data Insertion and Updates
Insert a new employee (id=101, name='John Doe', dept='IT', salary=75000) into employees table, then update all IT employees' salaries by 10% increase.
Question 14: HAVING without GROUP BY
Can HAVING clause be used without GROUP BY?
Question 15: SELECT DISTINCT Usage
What does SELECT DISTINCT do?
Question 16: Index Maintenance and Updates
How are indexes maintained when table data changes?
Question 17: LIKE Operator with Wildcards
From a customers table (customer_id, first_name, last_name, email, phone), find customers whose first name starts with 'J', email contains 'gmail', and phone number ends with '123'.
Question 18: INNER JOIN on Multiple Tables
You have three tables: orders (order_id, customer_id, product_id), customers (customer_id, name), and products (product_id, product_name). You want to list all orders with the customer name and product name for each order.
Question 19: FULL OUTER JOIN Use Case
You have two tables listing projects: assigned_projects (project_id, project_name, owner) and completed_projects (project_id, completion_date). You need a complete list of all projects, showing their completion date if they are finished, and their owner if they are assigned. Some projects might be assigned but not finished, and others might be finished but not in the assigned list (e.g., historical projects).
Question 20: Calculating Average
Which aggregate function calculates the average salary of employees?