At Cisco Systems, SQL is used day-to-day for analyzing network performance data, and as part of their Microsoft SQL Server hosting solution. Unsurprisingly this is why Cisco often asks SQL interview questions in interviews for Data Science, Data Engineering and Data Analytics jobs.
So, if you want to ace the SQL Interview, we've curated 8 Cisco Systems SQL interview questions to practice, which are similar to recently asked questions at Cisco – able to answer them all?
Cisco Systems is interested in how their different network components' quality ratings vary over time by clients. Their products' feedback is collected and stored. As a Data Analyst for Cisco, write a SQL query to calculate the average star ratings for each product per month.
Given the table that tracks each product review submitted by the customers:
review_id | client_id | submit_date | product_id | stars |
---|---|---|---|---|
6171 | 123 | 2022-06-08 | RTR-901 | 4 |
7802 | 265 | 2022-06-10 | SWT-1050 | 4 |
5293 | 362 | 2022-06-18 | RTR-901 | 3 |
6352 | 192 | 2022-07-26 | SWT-1050 | 3 |
4517 | 981 | 2022-07-05 | SWT-1050 | 2 |
We would like to produce the following output:
month | product | avg_stars |
---|---|---|
6 | RTR-901 | 3.50 |
6 | SWT-1050 | 4.00 |
7 | SWT-1050 | 2.50 |
You can use PostgreSQL's function to truncate the submission date to the month, to compute the average ratings, and to group the averages by month and product. Here's a PostgreSQL query that provides the solution:
This query first truncates the to the month level using , which produces a timestamp at the start of each month. Next, it groups the rows by this timestamp and using . Then, for each group, it uses to calculate the average rating. The ORDER BY clause helps to sort the result by month and product.
To solve another question about calculating review ratings, try this Amazon SQL question within DataLemur's interactive SQL code editor:
Assume that Cisco wants to keep track of the average bandwidth usage of their routers for managing their network infrastructure effectively. Data is logged in a table for each time a router makes a connection.
Given a table with the fields , , and , can you write a SQL query to calculate the average bandwidth usage per router?
connection_id | router_id | connect_time | bandwidth_used |
---|---|---|---|
1 | 1001 | 01/01/2022 00:00:00 | 5000 |
2 | 1001 | 01/01/2022 01:00:00 | 7000 |
3 | 1002 | 01/01/2022 00:30:00 | 9000 |
4 | 1002 | 01/01/2022 02:30:00 | 3000 |
5 | 1003 | 01/01/2022 01:45:00 | 6000 |
router_id | avg_bandwidth_used |
---|---|
1001 | 6000.0 |
1002 | 6000.0 |
1003 | 6000.0 |
This query averages the bandwidth used () per router (), by grouping the connections table by . The function calculates the average bandwidth used for each router_id.
"In SQL, a join generally retrieves rows from multiple tables and combines them into a single result set. For an example of the difference between a left vs. right join, suppose you had a table of Cisco orders and Cisco customers.
A retrieves all rows from the left table (in this case, the Orders table) and any matching rows from the right table (the Customers table). If there is no match in the right table, NULL values will be returned for the right table's columns.
A combines all rows from the right table (in this case, the Customers table) and any matching rows from the left table (the Orders table). If there is no match in the left table, NULL values will be displayed for the left table's columns.
Cisco has been running various digital ad campaigns. They are particularly interested in understanding how effective these campaigns are in driving users to click and navigate to their product pages. For this, they monitor the click-through rates (CTR) of these campaigns. The CTR is calculated as the total number of clicks that an ad receives divided by the total number of impressions (times the ad was served).
Sample Input Data:
impression_id | ad_id | impression_date |
---|---|---|
25418 | 101 | 07/20/2021 |
12485 | 102 | 07/21/2021 |
98473 | 101 | 07/22/2021 |
74625 | 103 | 07/23/2021 |
62591 | 104 | 07/24/2021 |
click_id | ad_id | click_date |
---|---|---|
32571 | 101 | 07/20/2021 |
27585 | 101 | 07/21/2021 |
98465 | 103 | 07/24/2021 |
62591 | 104 | 07/24/2021 |
19963 | 102 | 07/26/2021 |
Question: Write a query to calculate the daily click-through rates (CTR) for each ad in the month of July 2021.
This query first calculates the daily counts of impressions and clicks for each ad in the month of July 2021. It then joins these two tables together and calculates the click-through rate. The LEFT JOIN ensures that we still have rows for ads that had impressions but no clicks, and in these cases, the CTR is set to 0.
To solve a similar problem on DataLemur's free online SQL coding environment, try this Meta SQL interview question:
Some similarities between unique and non-unique indexes include:
Some differences between unique and non-unique indexes include:
Cisco being a multinational technology conglomerate, sells various products. The financial team needs to analyze their product performance from the revenue perspective on a quarterly basis. Using the data provided, write an SQL query to calculate the average revenue per quarter for each product over the year.
sale_id | product_id | sale_date | quantity_sold | sales_price |
---|---|---|---|---|
1256 | 3389 | 01/13/2021 | 4 | 700 |
7854 | 1105 | 04/02/2021 | 2 | 1500 |
2356 | 3389 | 02/21/2021 | 3 | 700 |
5684 | 1105 | 06/23/2021 | 1 | 1500 |
5697 | 8795 | 03/18/2021 | 5 | 550 |
9852 | 3389 | 08/27/2021 | 3 | 700 |
quarter | product_id | avg_revenue |
---|---|---|
1 | 3389 | 2800 |
1 | 1105 | 1500 |
1 | 8795 | 2750 |
2 | 1105 | 1500 |
3 | 3389 | 2100 |
This query is grouping the sales data by the quarter of the sale_date and product_id to compute the average revenue per product per quarter. The function DATE_TRUNC('quarter', sale_date) is used to get the quarter of a date. The AVG function is used to calculate the average revenue, where the revenue is calculated as quantity_sold times sales_price for each product per quarter.
The UNIQUE constraint makes sure that all values in a column are distinct. It is often paired with other constraints, like NOT NULL, to ensure that the data follows certain rules.
For example, say you were an analyst on the marketing team at Cisco, and had access to a database on marketing campaigns:
In this example, the UNIQUE constraint is applied to the "campaign_name" field to ensure that each campaign has a unique name. This helps to ensure the integrity of the data in the table and prevents errors that could occur if two campaigns had the same name.
As a data analyst at Cisco, you have been given two tables - one contains customer data ('customer') and the other contains order data ('orders'). Write a SQL query to find the average order amount for each state.
Here's your data:
customer_id | first_name | last_name | state |
---|---|---|---|
1 | John | Doe | California |
2 | Jane | Smith | Texas |
3 | Bob | Johnson | New York |
4 | Alice | Williams | California |
5 | Charlie | Brown | Texas |
order_id | customer_id | order_amount |
---|---|---|
1001 | 1 | 500 |
1002 | 2 | 300 |
1003 | 3 | 700 |
1004 | 4 | 800 |
1005 | 5 | 600 |
Your output should have the name of the state and the average order amount for that state.
state | avg_order_amount |
---|---|
California | 650 |
Texas | 450 |
New York | 700 |
This query first joins the customer and orders tables using the customer_id field. It then groups the data by state and calculates the average order amount for each group. The result is a list of states and their respective average order amounts.
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. Besides solving the earlier Cisco SQL interview questions, you should also solve the 200+ tricky sql questions on DataLemur which come from companies like Amazon, Microsoft, Meta, and smaller tech companies.
Each problem on DataLemur has hints to guide you, step-by-step solutions and best of all, there is an online SQL code editor so you can easily right in the browser your SQL query and have it checked.
To prep for the Cisco SQL interview you can also be useful to practice SQL problems from other tech companies like:
In case your SQL coding skills are weak, forget about going right into solving questions – refresh your SQL knowledge with this SQL interview tutorial.
This tutorial covers SQL topics like filtering data with WHERE and manipulating date/time data – both of which show up often during Cisco SQL assessments.
For the Cisco Data Science Interview, beyond writing SQL queries, the other types of questions to prepare for are:
To prepare for Cisco Data Science interviews read the book Ace the Data Science Interview because it's got: