You need to select one pitcher and one position player for your all-time fantasy baseball team. However, you want your position player to have a WAR of 30+ games higher than your pitcher. For this puzzle, you will need to determine how to classify each player as a poistion or pitcher given the metrics plate … Continue reading Fantasy Baseball Puzzle
Here is a good puzzle that shows the best use of the ANY and ALL SQL syntax. Given the following tables: Sales Representatives and Top Selling Products by Quarter; calculate the following commissions for the year. If ALL the top selling products for the quarter are from one region only, all sales representatives from that … Continue reading Calculate Commissions Puzzle
The ANY, ALL, and SOME operators in SQL Server are used to compare a value to a set of values. The SOME operator is a synonym for ANY and can be used interchangeably. These operators can be used in a variety of ways, such as with subqueries, to filter and retrieve specific data from a … Continue reading ANY, ALL, and SOME equivalents
Hello, here is a puzzle that makes perfect use of the FIRST_VALUE, LAST_VALUE, LAG, and the MIN functions. For the following dataset, you need to find the difference between each player's first score against the current score, as well as their last score against the current score. If their score improved from their previous score, … Continue reading First and Last Values
Does ChatGPT Know SQL? The short answer is "Yes, but not entirely". While ChatGPT may not be proficient in all aspects of SQL (actually, a lot of aspects of SQL), it is able to generate executable code and perform certain tasks. However, I found it unreliable when I asked about various database topics such as … Continue reading Does ChatGPT Know SQL?
In Microsoft SQL Server, there are several different types of databases that can be created and used for different purposes. Here is a brief overview of some of the most common types of databases in SQL Server and the scenarios in which they are typically used. Databases are categorized into two different types, User and … Continue reading What are the different SQL Server databases used for?
Time for a new puzzle. Given the below products table, return a result set of all Product Codes that are not associated with a Product Type that has multiple entries. The result set will contain the Product Codes of EE and GG as Product Codes 01, 02, 03 and 04 are associated to Alpha and … Continue reading Products Without Duplicates
If anyone wants a list of Database related certifications, I created a list. A couple of things first.... In my list below I have tried to list the certification that is most relevant to a Database Developer, Data Engineer or a Database Administrator role. Most vendor certifications are now role based focused (rather than being … Continue reading Database Certification List
Here is a fun puzzle that I was recently challenged with. Here we need to determine if a string is balanced if there is a matching opening and closing parenthesis, bracket or brace. Not only does the string need to have a matching parenthesis, bracket or brace, but the matching object also needs to be … Continue reading Unbalanced String Puzzle
In SQL, the MERGE statement is a powerful tool that allows you to perform multiple actions on a single table at once. However, it's not always the best choice and there are several reasons why you might want to consider using separate INSERT, UPDATE, and DELETE statements instead. There are a number of issues that … Continue reading Let’s talk about the MERGE statement