logo

9 L3Harris SQL Interview Questions (Updated 2024)

Updated on

December 7, 2023

At L3Harris Technologies, SQL is used quite frequently for analyzing vast defense-related datasets for actionable insights, and managing and querying aerospace and communication databases for optimization tasks. That's why L3Harris frequently asks SQL query questions in interviews for Data Analyst, Data Science, and BI jobs.

To practice here’s 9 L3Harris Technologies SQL interview questions, which are similar to recently asked questions at L3Harris – how many of them can you solve?

L3Harris

9 L3Harris SQL Interview Questions

SQL Question 1: Monthly Average Review Rating for Products

L3Harris often ask technicians who mantain and fix their defense and weapons systems to write reviews of different parts and products L3Harris makes.

Write a SQL query to calculate the monthly average review rating for each product. The output should have the month(from the submit date), product id and the average stars that product received in that given month. Consider the given sample input and expected output for reference.

Example Input:
review_iduser_idsubmit_dateproduct_idstars
617112306/08/2022 00:00:00500014
780226506/10/2022 00:00:00698524
529336206/18/2022 00:00:00500013
635219207/26/2022 00:00:00698523
451798107/05/2022 00:00:00698522
Expected Output:
mthproductavg_stars
6500013.50
6698524.00
7698522.50

Answer:


This query is first extracting the month from the submit_date, grouping the rows by this extracted month and product_id. Then it is calculating the average stars for this grouping. AVG function is used to calculate the mean of the stars column, resulting in the average star rating a product received in a given month.

SQL Question 2: Inventory Management for L3Harris

L3Harris works with very complicated supply-chains, and uses SQL to analyze the inventory of their different equipment parts. The task is to design a database system that tracks the inventory of different parts: how many are in storage, how many are in use, and how many are in need of maintenance.

Further, write a SQL query that will show all parts that are low in stock in storage (less than 10 items) and need replenishing, also list out the parts that are in need of maintenance.

Below are sample tables:

Example Input:
item_idpart_namein_storagein_usemaintenance_needed
1001Engine Type X15358
1002Propeller Model Y5274
1003Radar Type Z93410
1004Aileron Model A12226
1005Altitude Meter Model B8183

Example Output:

item_idpart_name
1002Propeller Model Y
1003Radar Type Z
1005Altitude Meter Model B

SQL Query:


The SQL query above selects and lists all parts that are either low in stock in storage (i.e., less than 10 items), or are in need of maintenance.

SQL QUESTION 3: What's the SQL command do, and when would you use it?

combines the results from two or more SELECT statements, but only returns the rows that are exactly the same between the two sets.

For example, say you were doing an HR Analytics project for L3Harris, and had access to L3Harris's contractors and employees data. Assume that some employees were previously contractors, and vice versa, and thus would show up in both tables. You could use operator to find all employees who also show up in the contractors table:


SQL Question 4: Filter Customer Records for Specific Criteria

L3Harris Technologies produces tactical radios, avionics, and electronic systems. They often need to filter their customer records based on various criteria.

In particular, the company wants to filter records to find out the customers from the USA parts who purchased avionic products in the last six months, and who have a customer status of 'active'.

Consider the following tables and as source data:

Example Input:
customer_idfirst_namelast_namecountrystatus
1JohnDoeUSAActive
2JaneSmithCanadaInactive
3AlbertJohnsonUSAActive
4MariaGarciaUSAInactive
5PeterWilliamsUKActive
Example Input:
purchase_idcustomer_idproduct_categorypurchase_date
10011Avionics2022-04-01
10022Avionics2022-05-30
10033Tactical Radios2022-03-15
10044Avionics2022-06-20
10055Electronic Systems2022-04-10

Write an SQL query that filters the customer records based on the above criteria.

Answer:


This SQL query joins the and tables on , and filters the records based on the specified conditions. It uses the clause to filter on country being 'USA', status being 'Active', product category being 'Avionics', and the purchase date being in the last six months.

The keyword in SQL is used to select values within a range. The function and function are used to calculate the range for the last six months.

SQL QUESTION 5: When it comes to database normalization, what's the difference between 1NF, 2NF, and 3NF?

The three levels of database normalization (also known as normal forms) are:

First Normal Form (1NF):

  • Each column should contain the same type of data (no mixing strings vs. integers)
  • Each column in a table contains a single value (no lists or containers of data)
  • Each row in the table is unique

Second Normal Form (2NF)

  • It's in 1st Normal Form
  • All non-key attributes are dependent on the primary key

Said another way, to achieve 2NF, besides following the 1NF criteria, the columns should also be dependent only on that table's primary key.

Third normal form (3NF) if it meets the following criteria:

  • It's in 2nd Normal Form
  • There are no transitive dependencies in the table.

A transitive dependency means values in one column are derived from data in another column. For example, it wouldn't make sense to keep a column called ""vehicle's age"" and ""vehicle's manufacture date" (because the vehicle's age can be derived from the date it was manufactured).

Although there is a 4NF and 5NF, you probably don't need to know it for the L3Harris interview.

SQL Interview Question 6: Find the Average Working Hours of Employees

Consider a scenario where you are working as a data analyst at L3Harris in the HR department, and are tasked with understanding more about the working hours of L3Harris employees. They might ask you to find the average working hours per day for each employee for the past month.

Here is some sample data:

Example Input:

emp_idnamedatehours_worked
1Smith2022-08-018
1Smith2022-08-026
1Smith2022-08-039
2Jones2022-08-017
2Jones2022-08-028
2Jones2022-08-037
3Brown2022-08-018
3Brown2022-08-028
3Brown2022-08-038

Example Output:

emp_idnameavg_hours_worked
1Smith7.67
2Jones7.33
3Brown8.00

Answer:

We could use the AVG function in SQL to get this data quite easily.


This query groups the data by employee id and name, and then calculates the average hours worked for these groups. In addition, the WHERE clause ensures that we are only considering work hours from the last month (August 2022 in this case).

To practice a related interactive Amazon Server Utilization Time Question which is similar because it involves calculating total time spent.

SQL QUESTION 7: What's the difference between a unique and non-unique index?

Unique indexes help ensure that there are no duplicate key values in a table, maintaining data integrity. They enforce uniqueness whenever keys are added or changed within the index.

To define a unique index in PostgreSQL, you can use the following syntax:


To define a non-unique index in PostgreSQL, you can use the following syntax:

Non-unique indexes on the other hand, are used to improve query performance by maintaining a sorted order of frequently used data values, but they do not enforce constraints on the associated table.


SQL Question 8: Calculate the Average Cost of Products per Department

Assume that L3Harris wants to monitor its factory production costs. You are provided with a database that includes two tables. One table () lists all the products manufactured by the company, with their respective costs. The other table () lists all the departments where these products are produced. You are asked to write a SQL query to calculate the average cost of products per department.

Example Input:
product_iddepartment_idcost
8008$120,000
7013$50,000
2402$90,000
6503$130,000
7212$80,000
4508$110,000
Example Input:
department_iddepartment_name
2Avionics
3Communication Systems
8Defense Systems
Example Output:
departmentavg_cost
Avionics$85,000
Communication Systems$90,000
Defense Systems$115,000

Answer:


Using the above SQL command, we first join the and tables on the department_id field. We then apply the GROUP BY command on the department_name field and calculate the average cost ( field) for each group. This answers the question of what the average cost of products is per department.

SQL QUESTION 9: What does do?

The COALESCE() function returns the first non-NULL value from a list of values. This function is often used to replace a NULL with some default value, so that you can then take a or of some column without NULLs messing things up.

For example, suppose you ran a customer satisfaction survey for L3Harris and had statements like "I'd buy from L3Harris again". In the survey, customers would then answer how strongly they agreed with a statement on a scale of 1 to 5 (strongly disagree, disagree, neutral, agreee, strongly agree).

Because attention spans are short, many customers skipped many of the questions, and thus our survey data might be filled with NULLs:

customer_idquestion_idagree_scale
10114
10125
20214
2022NULL
30315
3032NULL

Before doing further analytics on this customer survey data, you could replace the NULLs in the column with the value of (because that corresponds to the default 'neutral' answer) using the function:


This would result in the following:

customer_idquestion_idagree_scale
10114
10125
20214
20223
30315
30323

How To Prepare for the L3Harris 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 earlier L3Harris SQL interview questions, you should also solve the 200+ SQL questions from real Data Science & Analytics interviews which come from companies like Google, Microsoft and Silicon Valley startups. DataLemur Questions

Each SQL question has multiple hints, full answers and best of all, there is an interactive coding environment so you can right in the browser run your SQL query and have it checked.

To prep for the L3Harris SQL interview you can also be wise to solve SQL questions from other defense & aerospace contractors like:

However, if your SQL coding skills are weak, forget about jumping right into solving questions – strengthen your SQL foundations with this free SQL tutorial.

Interactive SQL tutorial

This tutorial covers things like joins and handling timestamps – both of these pop up frequently in SQL interviews at L3Harris.

L3Harris Technologies Data Science Interview Tips

What Do L3Harris Data Science Interviews Cover?

For the L3Harris Data Science Interview, besides SQL questions, the other types of questions to prepare for are:

  • Probability & Stats Questions
  • Coding Questions in Python or R
  • Data Case Study Questions
  • ML Modelling Questions
  • Behavioral Interview Questions

How To Prepare for L3Harris Data Science Interviews?

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

  • 201 interview questions taken from tech companies like Google & Microsoft
  • a crash course covering SQL, Product-Sense & ML
  • over 900+ reviews on Amazon & 4.5-star rating

Ace the DS Interview