A collection of Google SQL coding interview questions

Google SQL Interview Question – Calculate Correlation Coefficient

What is a right join in SQL?

A right join returns all rows from the right table, and the matched rows from the left table. Opposite of a left join, this will return all rows from the right table even where there is no match in the left table. Rows in the right table that have no match in the left table will have null values for left table columns.

What is the result of the following command?

This will result in an error because you can’t perform a DML operation on a view. A DML operation is any operation that manipulates the data such as DROP, INSERT, UPDATE, and DELETE.


GROUP BY gives us a way to combine rows and aggregate data. The HAVING clause is like the above WHERE clause, except that it acts on the grouped data.

The SQL statement below answers the question: “Which candidates received the largest number of contributions (ordered by count (*)) in 2016, but only those who had more than 80 contributions?”

Ordering this data set in a descending (DESC) order places the candidates with the largest number of contributions at the top of the list.

google sql interview questions

How to use a specific database

Here is the SQL command used to select the database containing the tables for your SQL statements:

What is a left join in SQL?

A left join returns all rows from the left table, and the matched rows from the right table. Rows in the left table will be returned even if there was no match in the right table. The rows from the left table with no match in the right table will have null for right table values.

What are the pseudocolumns in SQL? Give some examples?

A pseudocolumn behaves like a column, but is not actually stored in the table because it is all generated values. The values of a pseudocolumn can be selected but they cannot be inserted, updated, or deleted.

Can we perform a rollback after using ALTER command?

No, because ALTER is a DDL command and Oracle server performs an automatic COMMIT when the DDL statements are executed. DDL statements define data structures such as CREATE table and ALTER table.

Basic SQL Syntax Example

SQL is an international standard (ISO), but you will find some differences between implementations. This guide uses MySQL as an example because its the most popular implementation of SQL.

What Gets Asked in Google SQL Interviews?

Like all FAANG companies, Google relies heavily on data. And SQL is a go-to tool for processing and analyzing that data. Google SQL interviews don’t just ask basics. These interviews tend to ask case study SQL questions. In other words, you’ll be presented with more practical problems and real data, and be asked to write queries for that dataset. The most common questions to get asked include:

  • Basic SQL interview questions – These are typically definition-based questions, and they come up on the technical screen. One tip: Develop your ability to explain these basic SQL concepts in layman’s terms. (Check out our Basic SQL Questions guide for examples.)
  • SQL query questions – These types of questions test your knowledge in writing queries and statements in SQL. You’ll be presented with a dataset, and asked to write SQL code to return a specific value.
  • Advanced SQL questions – Finally, you may be asked specific case questions that will require you to write advanced SQL queries. With this type of questions, you’ll be asked to write queries that address a specific case, and use a range of SQL clauses, from basics like SELECT and FROM, to advanced like HAVING.
  • Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *