Open in app

Sign In

Write

Sign In

XuanKhanh Nguyen
XuanKhanh Nguyen

663 Followers

Home

About

Published in

Nothingaholic

·Feb 21, 2022

SQLNotes: Acceptance Rate By Date

Problem — What is the overall friend acceptance rate by date? Your output should have the rate of acceptance by the date the request was sent. Order by the earliest date to the latest. Assume that each friend request starts by a user sending (i.e., user_id_sender) a friend request to another user…

Sqlnotes

3 min read

SQLNotes: Acceptance Rate By Date
SQLNotes: Acceptance Rate By Date
Sqlnotes

3 min read


Published in

Nothingaholic

·Jan 30, 2022

SQLNotes: Order Details

Problem Find order details made by Jill and Eva. Consider the Jill and Eva as first names of customers. Output the order date, details and cost along with the first name. Order records based on the customer id in ascending order. Tables: customers +--------------+---------+ | id…

Sqlnotes

2 min read

SQLNotes: Order Details
SQLNotes: Order Details
Sqlnotes

2 min read


Published in

Nothingaholic

·Jan 23, 2022

SQLNotes: Salaries Differences

Problem Write a query that calculates the difference between the highest salaries found in the marketing and engineering departments. Output just the absolute difference in salaries. Tables: db_employee, db_dept db_employee +--------------+---------+ | id | int | +--------------+---------+ | first_name…

Sql

2 min read

SQLNotes: Salaries Differences
SQLNotes: Salaries Differences
Sql

2 min read


Published in

Nothingaholic

·Oct 3, 2021

SQLNotes: Reformat Department Table

1179. Reformat Department Table Problem Write an SQL query to reformat the table such that there is a department id column and a revenue column for each month. The query result format is in the following example: Department table: +------+---------+-------+ | id | revenue | month | +------+---------+-------+ | 1…

Sql

2 min read

Sql

2 min read


Published in

Nothingaholic

·Sep 30, 2021

SQL Notes: Rank Scores

178. Rank Scores Problem Table: Scores +-------------+---------+ | Column Name | Type | +-------------+---------+ | Id | int | | Score | decimal | +-------------+---------+ Id is the primary key for this table. Each row of this table contains the score of a game. …

Sql

2 min read

Sql

2 min read


Published in

Nothingaholic

·Sep 27, 2021

SQL Notes: Swap Salary

627. Swap Salary Problem Write an SQL query to swap all 'f' and 'm' values (i.e., change all 'f' values to 'm' and vice versa) with a single update statement and no intermediate temp table(s). Note that you must write a single update statement, DO NOT write any select statement for…

Sql

2 min read

Sql

2 min read


Published in

Nothingaholic

·Sep 26, 2021

SQL Notes: Delete Duplicate Emails

196. Delete Duplicate Emails Problem Write an SQL query to delete all the duplicate emails, keeping only one unique email with the smallest Id. Return the result table in any order. The query result format is in the following example. Example 1: Input: Person table: +----+------------------+ | Id | Email…

Leetcode

1 min read

Leetcode

1 min read


Published in

Nothingaholic

·Sep 26, 2021

SQL Notes: Nth Highest Salary

177. Nth Highest Salary Problem Table: Employee +-------------+------+ | Column Name | Type | +-------------+------+ | Id | int | | Salary | int | +-------------+------+ Id is the primary key column for this table. Each row of this table contains information about the salary of an employee. Write an SQL…

Sql

2 min read

Sql

2 min read


Published in

Nothingaholic

·Sep 26, 2021

SQL Notes: Rising Temperature

197. Rising Temperature Problem Write an SQL query to find all dates’ Id with higher temperatures compared to its previous dates (yesterday). Return the result table in any order. The query result format is in the following example. Example 1: Input: Weather table: +----+------------+-------------+ | Id | RecordDate | Temperature | +----+------------+-------------+ | 1…

Sql

1 min read

Sql

1 min read


Published in

Nothingaholic

·Sep 26, 2021

SQL Notes: Classes More Than 5 Students

596. Classes More Than 5 Students Problem There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the table: +---------+------------+ | student | class | +---------+------------+ | A | Math…

Leetcode

1 min read

Leetcode

1 min read

XuanKhanh Nguyen

XuanKhanh Nguyen

663 Followers

Interests: Data Science, Machine Learning, AI, Stats, Python | Minimalist | A fan of odd things.

Following
  • MIT IDE

    MIT IDE

  • Anne Bonfert

    Anne Bonfert

  • Dario Radečić

    Dario Radečić

  • Cassie Kozyrkov

    Cassie Kozyrkov

  • Matthew Stewart, PhD

    Matthew Stewart, PhD

See all (73)

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams