Data Analysts & Data Scientists at Simon Property write SQL queries as a core part of their job. They use SQL for analyzing tenant sales data, and for predicting customer behavio. For this reason Simon Property usually asks SQL interview problems.
Thus, to help you study for the Simon Property SQL interview, here's 8 Simon Property Group SQL interview questions – scroll down to start solving them!
Simon Property Group is a large real estate company, so a relevant dataset might include properties and rental income. Let's imagine you have two tables: and .
The table has each unique property identified by and includes additional details of interest:
property_id | building_type | location |
---|---|---|
1 | Shopping Mall | Indianapolis, IN |
2 | Outlet Mall | Las Vegas, NV |
3 | Shopping Mall | Orlando, FL |
4 | Shopping Mall | New York, NY |
5 | Office Building | San Francisco, CA |
The table logs the rental income received from each property per month:
property_id | month_year | income |
---|---|---|
1 | 2021-06 | $15000 |
1 | 2021-07 | $15500 |
2 | 2021-06 | $8000 |
2 | 2021-07 | $8500 |
3 | 2021-06 | $12000 |
3 | 2021-07 | $13000 |
4 | 2021-06 | $20000 |
4 | 2021-07 | $20500 |
5 | 2021-06 | $10000 |
5 | 2021-07 | $10500 |
Your task is to write a SQL query that calculates the average monthly income per property for the available months in the table. Show the output sorted by in descending order.
Here's a possible answer in PostgreSQL:
This query first joins the and tables on . It then applies a window function, , to calculate the average income for each property across the given months. The clause ensures the average is calculated per property. The final output is ordered by in descending order to show the properties generating the highest average income first.
Pro Tip: Window functions are a frequent SQL interview topic, so practice all the window function problems on DataLemur
Check out the Simon Properties Career page!
Assume you had a table of Simon Property employee salary data. Write a SQL query to find the top three highest paid employees within each department.
employee_id | name | salary | department_id |
---|---|---|---|
1 | Emma Thompson | 3800 | 1 |
2 | Daniel Rodriguez | 2230 | 1 |
3 | Olivia Smith | 2000 | 1 |
4 | Noah Johnson | 6800 | 2 |
5 | Sophia Martinez | 1750 | 1 |
8 | William Davis | 6800 | 2 |
10 | James Anderson | 4000 | 1 |
department_id | department_name |
---|---|
1 | Data Analytics |
2 | Data Science |
department_name | name | salary |
---|---|---|
Data Analytics | James Anderson | 4000 |
Data Analytics | Emma Thompson | 3800 |
Data Analytics | Daniel Rodriguez | 2230 |
Data Science | Noah Johnson | 6800 |
Data Science | William Davis | 6800 |
Write a SQL query for this interview question directly within the browser on DataLemur:
We use the DENSE_RANK() window function to generate unique ranks for each employee's salary within their department, with higher salaries receiving lower ranks. Then, we wrap this up in a CTE and filter the employees with a ranking of 3 or lower.
If the solution above is hard to understand, you can find a step-by-step solution with hints here: Top 3 Department Salaries.
Think of SQL constraints like the rules of a game. Just like a game needs rules to keep things fair and fun, a database needs constraints to keep things organized and accurate.
There are several types of SQL constraints like:
NOT NULL: This constraint is like a bouncer at a nightclub - it won't let anything NULL through the door. UNIQUE: This constraint is like a VIP list - only special, one-of-a-kind values get in. PRIMARY KEY: This constraint is like an elected official - it's made up of NOT NULL and UNIQUE values and helps identify each row in the table. FOREIGN KEY: This constraint is like a diplomatic ambassador - it helps establish relationships between tables. CHECK: This constraint is like a referee - it makes sure everything follows the rules. DEFAULT: This constraint is like a backup plan - it provides a default value if no other value is specified.
So, whether you're playing a game or organizing a database, constraints are an important part of the process!
As a data analyst for Simon Property, a company operating high-end shopping malls, you are given a task to analyze the leasing area in each property. You have access to two tables: and .
The table stores basic information about each of the properties owned by the company.
The table stores records of each lease, including which property the lease pertains to, the tenant's details, and the area leased.
We want to determine the most and least leased property in terms of area in the last fiscal year. Additionally, calculate the average leased area across all properties.
property_id | property_name | location |
---|---|---|
1 | The Fashion Mall | Indianapolis |
2 | Castleton Square | Indianapolis |
3 | Southridge Mall | Milwaukee |
4 | Roosevelt Field | Garden City |
5 | Tyrone Square Mall | St. Petersburg |
lease_id | property_id | tenant_id | lease_start | lease_end | leased_area |
---|---|---|---|---|---|
1001 | 1 | 5001 | 01/01/2021 | 12/31/2023 | 2000 |
1002 | 1 | 5002 | 01/06/2021 | 12/31/2022 | 2500 |
1003 | 2 | 5003 | 07/01/2021 | 06/30/2023 | 1500 |
1004 | 2 | 5004 | 03/01/2021 | 09/30/2021 | 500 |
1005 | 3 | 5005 | 05/01/2021 | 04/30/2023 | 3500 |
1006 | 3 | 5006 | 08/01/2021 | 07/31/2023 | 1200 |
1007 | 4 | 5007 | 02/01/2021 | 01/31/2023 | 5000 |
location | property_name | least_leased_area | most_leased_area | avg_leased_area |
---|---|---|---|---|
Indianapolis | Castleton Square | 2000 | 4500 | 3325 |
Milwaukee | Southridge Mall | 4700 | 4700 | 4700 |
Garden City | Roosevelt Field | 5000 | 5000 | 5000 |
This query first calculates the total leased area for each property within the specified time range. It then calculates the least, most, and average leased area across all properties.
To clarify the distinction between a primary key and a foreign key, let's examine employee data from Simon Property's HR database:
:
+------------+------------+------------+------------+ | employee_id| first_name | last_name | manager_id | +------------+------------+------------+------------+ | 1 | Aubrey | Graham | 3 | | 2 | Marshal | Mathers | 3 | | 3 | Dwayne | Carter | 4 | | 4 | Shawn | Carter | | +------------+------------+------------+------------+
In this table, serves as the primary key. It uniquely identifies each employee and cannot be null.
functions as a foreign key, linking to the of the employee's manager. This establishes a relationship between Simon Property employees and their managers, allowing for easy querying to find an employee's manager or see which employees report to a specific manager.
The table may also have multiple foreign keys that reference primary keys in other tables. For example, and foreign keys could be used to connect each employee to their respective department and location.
Simon Property as a real estate company maintains a database of all the properties they own. They would like to know the details of properties whose names contain the word "Plaza".
Assume that you have a table, which includes columns for , , , , and (in $).
property_id | property_name | location | purchase_date | value |
---|---|---|---|---|
1 | King's Place Mall | New York, NY | 2017-09-28 | 2300000 |
2 | Roosevelt Plaza | Chicago, IL | 2020-01-15 | 5600000 |
3 | Pennington Square | San Francisco, CA | 2019-06-12 | 8100000 |
4 | Piedmont Plaza | Atlanta, GA | 2018-03-20 | 4050000 |
5 | Monroe Center | Austin, TX | 2021-02-25 | 3200000 |
Write a SQL query that would help Simon Property retrieve the details of the properties whose names contain the word "Plaza".
Please include all columns in your result.
The on both sides of in the clause allows the database to return rows where appears anywhere in the . The is a wildcard that matches any number of characters, therefore will match any property_name that contains "Plaza", whether at the beginning, middle or end of the name.
The CHECK constraint is used to set a rule for the data in a column. If a row is inserted or updated and the data in the column does not follow the rule specified by the CHECK constraint, the operation will be unsuccessful.
For example, say you had Simon Property customer data. You could use a CHECK constraint to ensure that the email column contains only properly formatted email addresses, or that the age column contains only positive integer. Here's an example of that:
Simon Property owns a number of shopping malls, and each one has different stores. Each customer purchase in a store is logged in our database. We want to analyze the average purchase value for each property.
To do this, we need to write a SQL query that retrieves the property_id and the average purchase value for all properties.
We need to calculate the average from a table that stores customer purchases () and join it with another table that contains property details ().
Here's how the data is arranged:
purchase_id | customer_id | store_id | purchase_date | purchase_value |
---|---|---|---|---|
101 | 297 | 300 | 01/22/2021 | 50.00 |
102 | 612 | 501 | 03/18/2021 | 100.00 |
103 | 720 | 200 | 04/28/2021 | 25.00 |
104 | 125 | 300 | 06/15/2021 | 45.00 |
105 | 512 | 501 | 07/20/2021 | 70.00 |
property_id | property_name | store_id |
---|---|---|
1 | "Simon Mall A" | 300 |
2 | "Simon Mall B" | 200 |
3 | "Simon Mall C" | 501 |
You should return:
property_id | average_purchase_value |
---|---|
1 | 47.50 |
2 | 25.00 |
3 | 85.00 |
You can use a SQL query with the function and the two tables like this:
This query estimates the average purchase value for each property. It first combines the and the tables using a JOIN on the . Then, with the use of , it groups the results by . Finally, the function calculates the average for each of these groups.
Remember to ensure that data types of joining columns ( in this case) are compatible and the in the table is unique, or additional handling may be necessary.
Because join questions come up routinely during SQL interviews, take a stab at this SQL join question from Spotify:
Assuming that you've already got basic SQL skills, the next best tip we have to prepare for the Simon Property SQL interview is to solve as many practice SQL interview questions as you can! Besides solving the earlier Simon Property SQL interview questions, you should also solve the 200+ DataLemur SQL Interview Questions which come from companies like Google, Microsoft and Silicon Valley startups.
Each exercise has hints to guide you, fully explained answers along with a discussion board to see how others solved it and best of all, there's an interactive SQL code editor so you can right online code up your SQL query answer and have it graded.
To prep for the Simon Property SQL interview it is also useful to practice interview questions from other real estate and REIT 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 interview tutorial.
This tutorial covers things like Self-Joins and HAVING – both of which show up frequently during SQL interviews at Simon Property.
Besides SQL interview questions, the other question categories to prepare for the Simon Property Data Science Interview include:
I'm sorta biased, but I believe the best way to prepare for Simon Property Data Science interviews is to read the book Ace the Data Science Interview.
The book solves 201 interview questions taken from Facebook, Google & startups. It also has a refresher covering SQL, AB Testing & ML. And finally it's vouched for by the data community, which is why it's got over 1000+ 5-star reviews on Amazon.