# 8 Amadeus IT SQL Interview Questions (Updated 2024)

Updated on

February 14, 2024

At Amadeus IT Group, SQL is used quite frequently for analyzing vast hotel-related datasets for insights and managing complex databases to improve the company's travel IT solutions. Unsurprisingly this is why Amadeus IT almost always asks SQL questions during interviews for Data Science, Data Engineering and Data Analytics jobs.

As such, to help you practice for the Amadeus IT SQL interview, we've collected 8 Amadeus IT Group SQL interview questions – how many can you solve?

## 8 Amadeus IT Group SQL Interview Questions

### SQL Question 1: Calculate Average Booking Price Per Month Per Airline

Amadeus IT mantains a database of flight bookings as part of their Flight Search product. The dataset includes booking_id, booking_date, airline, and price. Write a SQL query to calculate the average booking price per month per airline using window function.

Note: For booking_date, assume it is provided in the format MM/DD/YYYY.

##### Example Input:
booking_idbooking_dateairlineprice
101/02/2022Delta300
201/03/2022Delta400
301/05/2022American350
402/04/2022Delta320
502/06/2022American400
603/02/2022Delta500
703/05/2022American550
803/06/2022Delta450
##### Example Output:
monthairlineaverage_price
1Delta350
1American350
2Delta320
2American400
3Delta475
3American550

This SQL query calculates the average price per month for each airline. The window function is used here to calculate the average price. The clause divides the result set into partitions (groups) and the average price is calculated for each group (month and airline). The function extracts the month from the date value. Finally, the result is ordered by month and airline.

Pro Tip: Window functions are a popular SQL interview topic, so practice every window function problem on DataLemur

### SQL Question 2: Filter Customers Based on Travel Details

In Amadeus IT, well-structured data is vital to assist various businesses such as hotels, airlines, and travel agencies. Given a customers table, write a SQL query to filter the customer records who traveled in February 2022, flew with 'Air Company A', stayed in 'Hotel B', and spent more on flights than on accommodations.

#### Example Input:

customer_idcustomer_nametravel_dateairline_companyhotel_nameflight_costaccommodation_cost
1002Bruce03/15/2022Air Company AHotel B600500
1003Charlie02/28/2022Air Company BHotel B400300
1004David02/15/2022Air Company AHotel C200400
1005Eve02/21/2022Air Company AHotel B800700

You can leverage the , commands like this:

This query first extracts the month and year from the travel_date column and checks whether it's in February 2022. It then proceeds to check whether the airline_company is 'Air Company A', the hotel_name is 'Hotel B', and the flight_cost is greater than the accommodation_cost.

### SQL Question 3: What do foreign key's do?

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 Amadeus IT customers table.

### SQL Question 4: Calculate the Average Delay in Departure of Flights

Given the flight status data of Amadeus IT, can you write a query to find the average delay in departure for each airline?

##### Example Input:
flight_idairline_companyscheduled_departureactual_departure
3362British Airways07/14/2022 20:00:0007/14/2022 20:50:00
9245Lufthansa07/24/2022 14:00:0007/24/2022 14:05:00
1742British Airways07/28/2022 18:00:0007/28/2022 18:30:00
##### Example Output:
airline_companyavg_departure_delay
British Airways25.0
Lufthansa5.0

The query first calculates the delay in departure for each flight (in minutes) by subtracting the scheduled_departure from the actual_departure, followed by averaging these delays over each airline_company using the AVG() function. Finally, the airline_company names and their corresponding average departure delays are selected.

To practice a very similar question try this interactive Amazon Server Utilization Time Question which is similar for calculating time-based metrics or this Facebook Active User Retention Question which is similar for analyzing user-based time data.

### SQL Question 5: Can you explain what an index is and the various types of indexes?

A database index is a data structure that provides a quick lookup of data in a column or columns of a table.

There are several types of indexes that can be used in a database:

1. Primary index: a unique identifier is used to access the row directly.
2. Unique index: used to enforce the uniqueness of the indexed columns in a table.
3. Composite index: created on multiple columns of a table, is used to speed up the search process for multiple columns
4. Clustered index: determines the physical order of the data in a table

### SQL Question 6: Filter Customer Records with LIKE Keyword

Amadeus IT needs to filter customer records who have their emails hosted with specific providers. They want to find how many customers have their email hosted with and .

Given the table shown below, write a SQL query that counts the number of customers with emails hosted on and .

##### Example Input:
customer_idfirst_namelast_nameemail
3412JohnDoejohndoe@gmail.com
9352JaneSmithjanesmith@yahoo.com
6384BobJohnsonbob77@gmail.com
9249AliceBakeraliceb@yahoo.com
8462CharlieBrowncbrown@gmail.com
##### Example Output:
email_hostcount
gmail.com3
yahoo.com2

This query uses the LIKE keyword to filter email addresses that end with or . It then counts the number of customers for each specified email host using the COUNT function and GROUP BY clause.

### SQL Question 7: Can you provide a comparison of cross join and natural join?

A cross join is a type of JOIN operation in SQL that creates a new table by combining each row from the first table with every row from the second table. It is also known as a cartesian join.

For example, say you worked on the Marketing Analytics team at Amadeus IT, and needed to understand what advertising copy (text) goes best with what advertising creative (the photo that gets posted with the advertisement copy).

Here is an example of a cross-join between a table of ad_copy and a table of ad_creative:

A natural join, on the other hand, is a type of JOIN that combines rows from two or more tables based on their common columns. It is called a "natural" join because it is based on the natural relationship that exists between the common columns in the tables being joined.

For an example of each one, say you had sales data exported from Amadeus IT's Salesforce CRM stored in a datawarehouse which had two tables: and .

An (which is a type of natural join) combines the two tables on the common

This query will return rows from the sales and tables that have matching customer id values. Only rows with matching values will be included in the results.

One main difference between cross joins and natural joins is that cross joins do not require any common columns between the tables being joined, while natural joins do. Another difference is that cross joins can create very large tables if the input tables have a large number of rows, while natural joins will only return a table with the number of rows equal to the number of matching rows in the input tables.

### SQL Question 8: Flight Cancellations Analysis

As a data analyst for Amadeus IT, you've been tasked with calculating the daily cancellation rate for several airlines for the month of July 2021. The cancellation rate should be measured as the number of cancelled flights divided by the total number of flights per day. Use the following tables: and .

##### Example Input:
flight_idairline_idflight_datedeparture_cityarrival_citystatus
101107/01/2021New YorkLondonCompleted
102107/01/2021TokyoParisCancelled
103107/02/2021New YorkTokyoCompleted
104207/02/2021ParisNew YorkCancelled
105207/02/2021LondonTokyoCompleted
##### Example Input:
airline_idairline_name
1AirwayFly
2SkyTravel

Your task is to write SQL query to output a table with columns: , , .

##### Example Output:
airline_nameflight_datecancellation_rate
AirwayFly2021-07-010.50
AirwayFly2021-07-020.00
SkyTravel2021-07-020.50

Here's the PostgreSQL query that will solve the problem:

The query joins the and tables on the column. It only considers flights that occurred in July 2021. It groups the flights by and and then calculates the cancellation rate as the number of cancelled flights (status = 'Cancelled') divided by the total number of flights. The resulting table shows the cancellation rate for each airline for each day in July 2021.

### How To Prepare for the Amadeus IT SQL Interview

The best way to prepare for a SQL interview, besides making sure you have strong SQL fundamentals, is to practice a ton of real SQL questions that were asked in recent job interviews. In addition to solving the above Amadeus IT SQL interview questions, you should also solve the 200+ SQL questions on DataLemur which come from companies like Microsoft, Google, and Facebook.

Each problem on DataLemur has multiple hints, step-by-step solutions and most importantly, there's an interactive coding environment so you can right in the browser run your SQL query answer and have it graded.

To prep for the Amadeus IT SQL interview it is also wise to practice SQL questions from other tech companies like:

However, if your SQL foundations are weak, don't worry about diving straight into solving questions – improve your SQL foundations with this DataLemur SQL tutorial.

This tutorial covers SQL topics like filtering data with WHERE and filtering on multiple conditions using AND/OR/NOT – both of these show up often in Amadeus IT SQL interviews.

### Amadeus IT Group Data Science Interview Tips

#### What Do Amadeus IT Data Science Interviews Cover?

Beyond writing SQL queries, the other types of questions to prepare for the Amadeus IT Data Science Interview are:

#### How To Prepare for Amadeus IT Data Science Interviews?

To prepare for Amadeus IT Data Science interviews read the book Ace the Data Science Interview because it's got:

• 201 interview questions taken from FAANG tech companies
• a refresher covering Python, SQL & ML
• over 900+ 5-star reviews on Amazon