1
Week Three Discussion
2
Week Three Discussion
This week’s task was about querying the salespeople table using basic SQL keywords,
and it was such a great opportunity to apply these basic concepts to a real-world situation. First,
you had to discover the first 10 sales agents hired by dealership 17. I did this with a SELECT
query dependent on a WHERE clause that restricts to dealership_id = 17, orderBy(hire_date,
ascending = TRUE) to sort just the hires within one dealership by this hire_date and finally
LIMIT 10 to keep only the first few hires. This exercise really helped me to realize that sorting
and limiting results help me in to trim down the response (Gadde,2022). It also demonstrated
how crucial clean, narrow queries are for getting just the information we want rather than
pulling in extra data.
Another aspect of the assignment was to locate salespeople who were hired in 2021 or
2022 and hadn’t been fired. To do that, I included a WHERE clause to filter for hire_date post
January 1, 2021, and to ensure their termination_date was NULL, which would mean the
employee is active (Shan et al., 2022). Then I ordered by hire_date desc to show the most recent
hire first. This was a good reminder for how databases’ active and inactive records are stored,
and when you need to account for missing values correctly in a filtering clause. The final
question asked us to get a salesperson hired in 2021 whose first name begins with “Nic.” I had
never used the LIKE clause with a wildcard before, and it’s a great example of the sheer magic
that is SQL when you just sort of know something, but not really. Overall, these are just some of
the tasks that made me more comfortable with SQL fundamentals and appreciate how each
keyword does something different when filtering data.
3
References
Shan, J., Goldwasser, M., Malik, U., & Johnston, B. (2022). SQL for data analytics (3rd ed.).
Packt Publishing.
Gadde, H. (2022). Integrating AI into SQL Query Processing: Challenges and Opportunities.
International Journal of Advanced Engineering Technologies and Innovations, 1(3), 194-
219.
Alghawazi, M., Alghazzawi, D., & Alarifi, S. (2022). Detection of sql injection attack using
machine learning techniques: a systematic literature review. Journal of Cybersecurity and
Privacy, 2(4), 764-777.