At Agilysys, SQL is used for extracting and analyzing guest-spending trends across various hospitality businesses, and managing data for BI report generation. For this reason Agilysys almost always asks SQL query questions in interviews for Data Science, Analytics, and & Data Engineering jobs.
As such, to help you study for the Agilysys SQL interview, we've collected 8 Agilysys SQL interview questions – can you solve them?
Assuming Agilysys's power users are characterized by high frequency transactions, write a SQL query that identifies top members who have executed the most purchases in the last 12 months.
member_id | first_name | last_name |
---|---|---|
1 | John | Doe |
2 | Jane | Smith |
3 | Emily | Jones |
4 | Robert | Brown |
5 | Sarah | Johnson |
order_id | member_id | order_date | total_order_value |
---|---|---|---|
1 | 1 | 2021-09-01 | 120.50 |
2 | 1 | 2021-09-10 | 150.00 |
3 | 2 | 2021-09-15 | 210.75 |
4 | 3 | 2021-09-25 | 300.00 |
5 | 4 | 2021-10-01 | 95.00 |
6 | 1 | 2021-10-05 | 200.25 |
7 | 5 | 2021-10-10 | 175.50 |
8 | 2 | 2021-10-15 | 320.00 |
9 | 1 | 2021-10-25 | 110.75 |
10 | 3 | 2021-11-01 | 220.00 |
first_name | last_name | order_count |
---|---|---|
John | Doe | 3 |
Jane | Smith | 2 |
Emily | Jones | 2 |
Sarah | Johnson | 1 |
Robert | Brown | 1 |
The purpose of the query is to determine which users have the highest frequency of transactions in the last 12 months, defined as "power users". By joining the members and orders tables, and applying a count operation grouped by the member_id, the query returns the count of orders for each user, and orders them in descending order to highlight the power users at the top.
To solve a super-customer analysis question on DataLemur's free interactive SQL code editor, try this Microsoft Azure Cloud SQL Interview Question:
Agilysys Inc. develops industry-specific technology solutions to help manage complex businesses. Suppose you are the data analyst in this company and have been tasked with analyzing the sales data. Your task is to find the total sales of each product by month, along with the running total of sales (to study the performance and trend of each product). The table sales data below has the sales volume information.
You need to Write a SQL window function to solve this problem.
sales_id | sales_date | product_id | sales_volume |
---|---|---|---|
7941 | 02/04/2022 | 101 | 25 |
8973 | 02/04/2022 | 102 | 30 |
5126 | 03/06/2022 | 101 | 20 |
6613 | 03/06/2022 | 102 | 35 |
3336 | 04/08/2022 | 101 | 15 |
4567 | 04/08/2022 | 102 | 40 |
This PostgreSQL query will give the total sales of each product by date and the running total of sales. The use of the PARTITION BY clause in the window function ensures that the running total (cumulative sum of sales volume) restarts for each product. The ORDER BY clause in the window function specifies the order in which the running total should be calculated.
The WINDOW functions provide more flexibility to solve various problems that can not be solved using the standard aggregation in a simpler way. In this problem, getting the running total requires utilizing the power of window functions. It provides a unique way of performing calculations against a set of table rows that are somehow related to the current row, here it is being used to get cumulative sales.
To solve a related window function SQL problem on DataLemur's free online SQL coding environment, try this Amazon SQL Interview Question:
One way to find duplicatesis to use a clause and then use to find groups
You could also use the operator:
You are working as a database administrator at the company Agilysys. The marketing department wants to launch a marketing campaign targeting a specific group of customers, and they ask you for help to extract the correct data.
In a table named , which contains a record of all customers, there's a text column . They want to find all records where the includes the pattern 'Tech'.
Your task is to provide a list of customer names (), company names (), and their contact numbers () for all records where the includes 'Tech'.
This SQL query uses the keyword along with the wildcard character on both ends of 'Tech' to filter the table. The character is used to represent zero, one, or multiple characters. This means the query will find any that has 'Tech' in any position.
When using , only rows that are identical in both sets will be returned.
For a concrete example, say you were a Data Analyst supporting the Sales Analytics team at Agilysys, and data on potential sales leads lived in both Salesforce and Hubspot CRMs. To write a query to analyze leads created before 2023 started, that show up in BOTH CRMs, you would use the command:
Let's say, as a Data Analyst at Agilysys, you are given two tables - and . The table stores information about all the customers, and the table stores data about all the orders made by these customers. Your task is to write a SQL query to find all customers who have made purchases over $2000 and find out their name and total order amount.
The tables have been defined as follows:
customer_id | first_name | last_name | email_address |
---|---|---|---|
1 | John | Doe | john.doe@email.com |
2 | Jane | Smith | jane.smith@email.com |
3 | Sam | Johnson | sam.johnson@email.com |
4 | William | Brown | william.brown@email.com |
5 | Emma | Davis | emma.davis@email.com |
order_id | customer_id | order_amount | order_date |
---|---|---|---|
1001 | 2 | 500 | 2022-08-01 |
1002 | 2 | 2000 | 2022-08-05 |
1003 | 2 | 600 | 2022-09-01 |
1004 | 1 | 1500 | 2022-07-15 |
1005 | 3 | 5000 | 2022-09-01 |
1006 | 4 | 2000 | 2022-06-01 |
1007 | 5 | 1200 | 2022-07-18 |
In this query, we are joining the and tables on the column. The clause groups the result by , and , so that we can get the total per customer. The clause then filters the results to only include customers whose total is greater than $2000.
Since joins come up so often during SQL interviews, take a stab at this SQL join question from Spotify:
A foreign key is a column or group of columns in a table that refers to the primary key in another table. The foreign key constraint helps maintain referential integrity between the two tables. The table with the foreign key is called the child table, while the table with the candidate key is called the parent or referenced table.
For example, consider a database with two tables: and customer_idcustomer_idcustomer_id` column in Agilysys customers table.
Agilysys is a leading provider of integrated hospitality software solutions. Suppose you are the data analyst working for Agilysys, and you have been asked to retrieve the most liked hotel service each month based on ratings. A service is considered more liked if it has a higher average rating. The hotel services and their ratings are stored in two tables: and .
service_id | service_name |
---|---|
101 | Room Cleaning |
102 | Food and Beverage |
103 | Airport Shuttle |
104 | Free Breakfast |
rating_id | user_id | rating_date | service_id | stars |
---|---|---|---|---|
1 | 123 | 06/08/2022 00:00:00 | 102 | 4 |
2 | 265 | 06/10/2022 00:00:00 | 101 | 4 |
3 | 362 | 06/18/2022 00:00:00 | 101 | 3 |
4 | 192 | 07/26/2022 00:00:00 | 102 | 3 |
5 | 981 | 07/05/2022 00:00:00 | 101 | 2 |
This query first calculates the monthly average star rating for each service id (), then fetches the service having the maximum average star rating for each month. The month, service_id, service_name, and its average rating are selected in the final output. A JOIN is used to get the service name from the . The WHERE clause with a subquery filters out rows with the maximum average stars in each month.
The best way to prepare for a Agilysys SQL interview is to practice, practice, practice. In addition to solving the above Agilysys SQL interview questions, you should also solve the 200+ SQL questions from real Data Science & Analytics interviews which come from companies like FAANG (FB, Apple, Amazon, Netflix, Google).
Each SQL question has multiple hints, full answers and most importantly, there is an interactive SQL code editor so you can right in the browser run your SQL query answer and have it executed.
To prep for the Agilysys SQL interview you can also be helpful to solve interview questions from other tech companies like:
But if your SQL query skills are weak, don't worry about going right into solving questions – go learn SQL with this SQL tutorial for Data Analytics.
This tutorial covers SQL concepts such as joining a table to itself and math functions like ROUND()/CEIL() – both of which come up routinely during Agilysys SQL assessments.
In addition to SQL query questions, the other question categories to practice for the Agilysys Data Science Interview are:
The best way to prepare for Agilysys Data Science interviews is by reading Ace the Data Science Interview. The book's got: