Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views3 pages

SQL DML Questions Data Engineer

Uploaded by

tempuse73
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

SQL DML Questions Data Engineer

Uploaded by

tempuse73
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

50 SQL DML Practice Questions for Data Engineering Interviews

This document contains 50 SQL questions focused on Data Manipulation Language (DML)

concepts, tailored for Data Engineering interviews. All questions are based on the following table:

Table: Customer

| id | name | email | referee_id |

|----|-------|--------------------|------------|

| 1 | Will | [email protected] | NULL |

| 2 | Jane | [email protected] | 1 |

| 3 | Alex | [email protected] | 2 |

| 4 | Bill | [email protected] | 2 |

| 5 | Zack | [email protected] | NULL |

| 6 | Mark | [email protected] | 3 |

| 7 | Nina | [email protected] | NULL |

| 8 | Ryan | [email protected] | 5 |

1. Insert a new customer (9, 'Olivia', NULL) without an email address.

2. Insert two customers: (10, 'Emma', '[email protected]'), (11, 'Liam', '[email protected]').

3. Update Zack's email to [email protected].

4. Update Alex's referee_id to 5.

5. Set the email of all customers whose name starts with 'R' to NULL.

6. Set the referee_id to NULL for customers whose email is NULL.

7. Delete all customers whose name is either 'Will' or 'Bill'.

8. Delete customer with id = 6.

9. Delete all customers with NULL emails.

10. Return all customers who do not have a referee.

11. Return names and emails of customers who were referred by customer with id = 2.
12. Count how many customers have non-null emails.

13. Count customers whose names start with 'A'.

14. Return customers whose email ends with 'example.com'.

15. Return names of customers whose name contains 'i' (case-insensitive).

16. Return customers ordered by name descending.

17. Return top 3 customers with the smallest ID values.

18. Find customers with the longest name.

19. Find customers with the shortest name.

20. Change all emails ending with 'example.com' to NULL.

21. Update all customers referred by id=1 to be referred by id=3.

22. Insert a customer with a duplicate email and analyze the result.

23. Insert multiple customers using a single query.

24. Delete customers with names in the list ('Mark', 'Zack').

25. Update names of all customers to uppercase.

26. Update all NULL referee_ids to 0.

27. Change all '@example.com' domains to '@demo.com'.

28. Delete all customers whose names are 4 letters long.

29. Return customers with emails containing numbers.

30. Count how many customers have both a non-null email and referee_id.

31. Return customers whose name is a palindrome.

32. Insert a customer with a very long name and check length behavior.

33. Update email to lowercase for all customers.

34. Insert a customer with today's timestamp and check default handling (if timestamp field exists).

35. Delete customers where id is greater than 10.

36. Return the average length of customer names.

37. Return all customers where referee_id is not in (1, 2, 3).

38. Update emails to NULL for customers with even ids.


39. Insert a customer and then immediately delete it.

40. Count customers grouped by referee_id.

41. Delete all customers except those referred by Jane.

42. Return all customers with duplicate referee_ids.

43. Insert a new customer using a subquery to get the max id + 1.

44. Update names of all customers referred by id=2 to prefix 'Ref2 -'.

45. Delete customers who are not referred by anyone and whose name starts with 'N'.

46. Update referee_id for all customers whose id is odd to NULL.

47. Insert 5 customers using a loop (simulate using SQL UNIONs).

48. Return customers whose email domain is either 'example.com' or 'demo.com'.

49. Update email for Zack only if it hasn't been updated already.

50. Delete all customers and reset the auto-increment (if supported).

You might also like