#SQL

Published: 08 September 2024
on channel: The Code Samples
214
15

#SQL Leetcode SQL 50 #21: 1174:
Write a solution to find the percentage of immediate orders in the first orders of all customers, rounded to 2 decimal places. If the customer's preferred delivery date is the same as the order date, then the order is called immediate; otherwise, it is called scheduled.

The first order of a customer is the order with the earliest order date that the customer made. It is guaranteed that a customer has precisely one first order. We will be using subquery to solve this.

We will be solving all the questions from LeetCode SQL 50 one by one. These questions range from easy to hard.

**SQL scripts you can use to create and populate the table:
-- Create the Delivery table
CREATE TABLE Delivery (
delivery_id INT,
customer_id INT,
order_date DATE,
customer_pref_delivery_date DATE
);

-- Insert data into the Delivery table
INSERT INTO Delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) VALUES
(1, 1, '2019-08-01', '2019-08-02'),
(2, 2, '2019-08-02', '2019-08-02');

#datascience #coding #programming #mssql #databasemanagement #leetcode #leetcode1174 #leetcodesolution

👉SQL Tutorials Playlist:
   • SQL Tutorials  

👉SQL Shorts Playlist:
   • SQL Shorts  

👉Python Shorts Playlist:
   • Playlist  

👉Python Tutorials Playlist:
   • Python Tutorials  

👉Excel Shorts Playlist:
   • Excel Shorts  


On this page of the site you can watch the video online #SQL with a duration of hours minute second in good quality, which was uploaded by the user The Code Samples 08 September 2024, share the link with friends and acquaintances, this video has already been watched 214 times on youtube and it was liked by 15 viewers. Enjoy your viewing!