Coding interview preparation
5.82K subscribers
459 photos
79 files
164 links
Download Telegram
SQL Question:

Which query finds premium users only?
3👏1
20 SQL Interview Questions
Introduction to Arrays
Understanding OAuth

OAuth is an open standard that allows users to grant limited access to their data on one site to other sites or applications without exposing their passwords.

The OAuth ecosystem

OAuth connects three main players:

- The User who wants to grant access to their data without sharing login credentials
- The Server that hosts the user's data and provides access tokens
- The Identity Provider (IdP) that authenticates the user's identity and issues tokens

How OAuth works

When a user tries to access their data through a third-party app, they are redirected to log in through the IdP. The IdP sends an access token to the app, which presents it to the server. Recognizing the valid token, the server grants access.

The OAuth flows

OAuth 2.0 defines 4 flows for obtaining authorization tokens:

- Authorization Code Flow - for server-side applications
- Client Credentials Flow - when the app is the resource owner
- Implicit Code Flow - not secure and no longer recommended
- Resource Owner Flow
1
System Design Blueprint

This template helps to tackle various system design problems in interviews.

Hope this checklist is useful to guide your discussions during the interview process.

This briefly touches on the following discussion points:
- Load Balancing
- API Gateway
- Communication Protocols
- Content Delivery Network (CDN)
- Database
- Cache
- Message Queue
- Unique ID Generation
- Scalability
- Availability
- Performance
- Security
- Fault Tolerance and Resilience
- And more
2
SQL question:

What will this query return?
Coding interview preparation
SQL question: What will this query return?
Hey everyone, quick follow-up to today’s SQL quiz!👇

The query was:
SELECT COUNT(*) FROM employees HAVING COUNT(*) > 0;

Our active members picked B) 1, C) 0 or D) Error… but let’s break it down real quick!

➡️ COUNT(*) in the SELECT counts ALL rows in the table → with 10 rows it returns 10

➡️ The HAVING clause filters after aggregation

➡️ HAVING COUNT(*) > 0 simply checks if the total count is greater than 0 (which it always is unless the table is empty)

🟢 So the query returns exactly one row with the value 10.

The question was a valid (just a bit tricky/wordy) way to write
give me the total row count, but only if there’s at least one row



Correct answer: A) 10

Unfortunately no one got it right😅
Better luck next time folks, you’re all still SQL legends in my book! 💙
3
SSH Under the hood
SQL Question:

Query Optimization

Which query are you running and why?
8 Popular Network Protocols Explained in 1 Simple Diagram
You're giving an interview, and the interviewer asks,

What is the difference between CHAR and VARCHAR2 datatype in SQL?


Here's how you can answer:

Sample Answer:

CHAR and VARCHAR2 are both used to store text in SQL, but they work differently. CHAR is fixed-length, meaning it always uses the same amount of space no matter how short the text is. For example, if you set a column to CHAR(10) and store ‘Hi’, it will still take up 10 spaces, adding extra padding to fill the space. This can waste storage but is consistent in size.

VARCHAR2, on the other hand, is variable-length, so it only uses as much space as needed for the text. If you set a column to VARCHAR2(10) and store ‘Hi’, it only takes 2 spaces plus a little extra to store the length, saving space.

Use CHAR when your data is always the same length, like codes or short identifiers. Use VARCHAR2 when your data varies in length, like names or descriptions. CHAR can be slightly faster for fixed-length data, but VARCHAR2 is more efficient for saving space and handling different text lengths.
3
How Does HTTPS Work?
10 Types of API Testing
2
Big Data Pipelines on the Cloud
Session, JWT, SSO, and OAuth 2.0 in One Diagram
Key Database Sharding Concepts
API Security 101