![CodeInQueries](/img/default-banner.jpg)
- 364
- 44 817
CodeInQueries
India
Registrace 12. 08. 2016
Hello !!
I am Kanhaiya Kumar Gupta. I am a data analyst and in the CZcams channel i uploaded videos related to Data analytics tutorial like SQL python excel etc in Hindi language.
I am Kanhaiya Kumar Gupta. I am a data analyst and in the CZcams channel i uploaded videos related to Data analytics tutorial like SQL python excel etc in Hindi language.
How to Compute the Product of Numbers | SQL Interview Question
Welcome to CodeInQueries! 🧑💻 In this video, we’ll cover a common SQL interview question: How to compute the product of numbers in SQL. While SQL has built-in functions like SUM() and AVG(), there’s no direct function for calculating the product of numbers. We’ll show you how to work around this using advanced SQL techniques.
🔹 Topics Covered:
solution 1:-
Using SQL to compute the product of numbers in a column
Applying EXP() and LOG() functions to simulate the product
Understanding the limitations of SQL and creative solutions
solution 2:-
using recursive cte
🔹 Scenario: Suppose you have a table of numbers and you want to compute the product of these numbers across rows. Since there is no built-in PRODUCT() function in SQL, we'll show you an alternative method using logarithmic and exponential functions.
In this query:
We use LOG() to take the logarithm of each number in the column.
We sum the logarithms and then use EXP() to get the product, which is the inverse of taking the logarithm.
💡 Note: Make sure the numbers in the column are greater than zero, as logarithms of zero or negative numbers are undefined.
🔔 Subscribe to CodeInQueries for more advanced SQL tips, interview prep content, and hands-on tutorials.
👍 Like, comment, and share if this video helped you!
#SQLInterviewQuestions #ProductOfNumbers #AdvancedSQL #SQLServer #DataProcessing #LearnSQL #SQLTips #CodeInQueries #DatabaseManagement #SQLForBeginners
🔹 Topics Covered:
solution 1:-
Using SQL to compute the product of numbers in a column
Applying EXP() and LOG() functions to simulate the product
Understanding the limitations of SQL and creative solutions
solution 2:-
using recursive cte
🔹 Scenario: Suppose you have a table of numbers and you want to compute the product of these numbers across rows. Since there is no built-in PRODUCT() function in SQL, we'll show you an alternative method using logarithmic and exponential functions.
In this query:
We use LOG() to take the logarithm of each number in the column.
We sum the logarithms and then use EXP() to get the product, which is the inverse of taking the logarithm.
💡 Note: Make sure the numbers in the column are greater than zero, as logarithms of zero or negative numbers are undefined.
🔔 Subscribe to CodeInQueries for more advanced SQL tips, interview prep content, and hands-on tutorials.
👍 Like, comment, and share if this video helped you!
#SQLInterviewQuestions #ProductOfNumbers #AdvancedSQL #SQLServer #DataProcessing #LearnSQL #SQLTips #CodeInQueries #DatabaseManagement #SQLForBeginners
zhlédnutí: 99
Video
Find the Highest and Lowest Populations City of each States | SQL Interview Questions
zhlédnutí 144Před dnem
Find the Highest and Lowest Populations City of each States | SQL Interview Questions
How to Delete Duplicate Records | SQL Tutorial
zhlédnutí 137Před dnem
How to Delete Duplicate Records | SQL Tutorial
Type Casting and Escape Characters in Python | Python Tutorial for Beginners
zhlédnutí 36Před 14 dny
Type Casting and Escape Characters in Python | Python Tutorial for Beginners
How to Mask Credit Card Numbers in SQL | SQL Interview Questions
zhlédnutí 112Před 14 dny
How to Mask Credit Card Numbers in SQL | SQL Interview Questions
Data Types in Python | Python Tutorial for Beginners
zhlédnutí 38Před 14 dny
Data Types in Python | Python Tutorial for Beginners
SQL Query Challenge: Understanding NULL and Conditional Logic
zhlédnutí 77Před 21 dnem
SQL Query Challenge: Understanding NULL and Conditional Logic
Python Keywords and Identifiers | Python Basics for Beginners
zhlédnutí 19Před 21 dnem
Python Keywords and Identifiers | Python Basics for Beginners
Find the Maximum ID After Removing Duplicates | SQL Interview Questions
zhlédnutí 110Před 21 dnem
Find the Maximum ID After Removing Duplicates | SQL Interview Questions
Introduction of Python | Python for Data Analysis
zhlédnutí 42Před 21 dnem
Introduction of Python | Python for Data Analysis
Find the Length of the Third Consecutive Date Streak | SQL Server Tutorial
zhlédnutí 139Před měsícem
Find the Length of the Third Consecutive Date Streak | SQL Server Tutorial
Employees who earn less than their friends || SQL Interview Questions
zhlédnutí 69Před měsícem
Employees who earn less than their friends || SQL Interview Questions
Create Function for Split Full Name into First, Middle, and Last Name | SQL Server Tutorial
zhlédnutí 314Před měsícem
Create Function for Split Full Name into First, Middle, and Last Name | SQL Server Tutorial
Replace Numeric Values from alphanumeric value in SQL Server
zhlédnutí 96Před měsícem
Replace Numeric Values from alphanumeric value in SQL Server
Create a Stored Procedure for Delete Duplicates from any table || SQL Server
zhlédnutí 309Před měsícem
Create a Stored Procedure for Delete Duplicates from any table || SQL Server
How to Create Age Range without using case statement | SQL Interview Questions
zhlédnutí 224Před měsícem
How to Create Age Range without using case statement | SQL Interview Questions
Average Time of Process per Machine || Leetcode SQL Question
zhlédnutí 26Před měsícem
Average Time of Process per Machine || Leetcode SQL Question
Percentage of Users Attended a Contest | Leetcode SQL Questions
zhlédnutí 31Před měsícem
Percentage of Users Attended a Contest | Leetcode SQL Questions
SQL Interview Questions | Ace Your Data Analyst Interview
zhlédnutí 220Před měsícem
SQL Interview Questions | Ace Your Data Analyst Interview
While Loop in SQL Server || SQL Tutorial
zhlédnutí 125Před měsícem
While Loop in SQL Server || SQL Tutorial
Bank Account Summary II || Leetcode SQL Questions
zhlédnutí 35Před měsícem
Bank Account Summary II || Leetcode SQL Questions
Temporary Tables in SQL | SQL Tutorial
zhlédnutí 86Před měsícem
Temporary Tables in SQL | SQL Tutorial
Subquery, Correlated Subquery, CTE, and Recursive CTE in SQL | SQL Tutorial
zhlédnutí 77Před měsícem
Subquery, Correlated Subquery, CTE, and Recursive CTE in SQL | SQL Tutorial
Customer Who Visited but Did Not Make Any Transactions || Leetcode SQL Questions
zhlédnutí 33Před 2 měsíci
Customer Who Visited but Did Not Make Any Transactions || Leetcode SQL Questions
Patients With a Condition || Leetcode SQL Questions
zhlédnutí 17Před 2 měsíci
Patients With a Condition || Leetcode SQL Questions
Find Users With Valid Emails || Leetcode SQL Questions
zhlédnutí 35Před 2 měsíci
Find Users With Valid Emails || Leetcode SQL Questions
Group Sold Products By The Date || Leetcode SQL Question
zhlédnutí 33Před 2 měsíci
Group Sold Products By The Date || Leetcode SQL Question
Top Travellers || Leetcode SQL Questions
zhlédnutí 25Před 2 měsíci
Top Travellers || Leetcode SQL Questions
Capital Gain Loss || Leetcode SQL Questions
zhlédnutí 27Před 2 měsíci
Capital Gain Loss || Leetcode SQL Questions
You should explain the question first.
@@deepanshurathore9661 bro this not a first part in first part I explained the question
Thank you for your efforts to explain these complex quarries, I understood the explanation but did not understand why why used row_number =1 , I would appreciate your clarification from the same.
I was selecting the first row value
Full video dalo na adha hi hai ye Bhai
Uploaded hai bro
SSIS pr v playlist start kro sir ❤🎉
After completing python I will think about starting ssis
Grt job..1 advice...It would be better if u also provide the data scripts so we can also practice the questions in our machine
@@nishchaljain9351 okay I will try
Could please provide the dataset for this video 😊
I suggest you to restore adventuresworklt database bak file ... Download it from Google
Is it there in adventure worklt
@@muralikanala2100 yes
Well explained brother
@@princekhunt13579 thank you
with cte as( select *, min(order_date) firstOrder from Delivery group by customer_id ) select round(sum(firstOrder = customer_pref_delivery_date) * 100 / count(*), 2) immediate_percentage from cte; why is this not working?
101, 450
@@varunm3309 wrong answer
sir please upload daily video of python, its very helpful and in hindi we clearly understand each line, please upload daily
Okay I will try but it's not possible... because after my office I have to record then I need time to edit
First like
@@CharanchanduKilari-qq2vh thankyou 😊👍
Getting error “ the query processor could not produce a query plan because the target DML table is not hash partitioned” Able to read duplicates but only delete is not working
Don't know bro it's working for me I think you don't have permission
@@CodeInQueries i have created new table with by setting distribution method to hash and its working fine.
👍👍👍👍👍
@@A2ZNETWORKS 😀👍
❤😮tq sir
🙂👍
I am fresher preparing for data analystics domain, for queries will it be enough for me to solve the question you tell in your playlist as fresher or extra is there any need to do.
@@akashkhantwal2430 if you solved hacker rank SQL question and Leetcode SQL question that's enough for freshers
Thank you sir for making this type of video,, its help me a lot☺
@@akashkhantwal2430 thankyou akash
🙏🙏❤
😊❤️👍
The best channel for SQL i would say you are doing a great work brother Keep it Up!
@@harshilmaru7096 thank you ❤️
❤
Is null
@@akashkhantwal2430 right 👍
Recursive procedure bhi batao na explain pls
Okay 👍
split full name in 3 column using store procedure please create video on this question eg. full name - ABC PQR XYZ OP: FIRST NAME ! Middle Name ! Last name ABC ! PQR ! XYZ
@@arjunzarekar1740 I will create function for it. Because we can't call stored procedure in select Query
Great video, sir. I'm new to cloud data engineering and I want to learn advanced SQL. Could you please help me?
@@ashishvats1515 yes why not?
SQL> select e.*,concat(concat(trunc((age-1)/10)*10+1,'-'),trunc(((age-1)/10)+1)*10) as employee_age from employee_age e; EMP_ID AGE EMPLOYEE_AGE ---------- ---------- --------------------------------------------------------------------------------- 1 5 1-10 2 16 11-20 3 19 11-20 4 31 31-40 5 50 41-50
Trunc ? Which rdms are you using
@@CodeInQueries oracle
Union
@@mishrajee861 👍
Complete nahi ho raha hai ek bhi query
A
A
Bhai query kaha hai
Video upload hai youtube par
A
Bhai pura query nahi hoa video khatam hogaya us se pahle hi.
@@shaikharif1352 ohh sorry I will create full video soon
।
This helps me a lot thank u so much sir ♥
@@mohit_y23 🙂👍
Please provide course notes
Visit my insta @codeinqueries in profile notes link is added
A,c
@@anuragborse9800 are you sure?
💯
@@anuragborse9800 please check varchar is not Unicode data type
not able to see complete out put, if you minimize your image then it is possible to see. Request you to please minimize your image. Thank you!
@@priyankachahande1909 really Sorry I will take care of it from next time
@@CodeInQueries Thank you !! Videos are really helpful
row_number() built-in function hai? and row_number() ke sath over() q use kiya hai aapne?
Row_number() ek windows function hai or windows function mein over use hoga
@@CodeInQueries thank you
bro cte to table name hai na yha pr cte ke place par aur dusra koi sa v name bhi likh sakte hai na and row_number() built-in function hai? and row_number() ke sath over() q use kiya hai aapne?
@@souravsharma5804 yes right
a
@@omernomaan5556 good
Nice videos ....Please continue posting leetcode videos.
@@priyankachahande1909 thank you, yes I will post more videos
Upload answer also, I hope you know yourself. Otherwise it's just useless.
Imma revise SQL and reply with the code, last wrote 3 months ago
But this solution has a flaw... Like if 20,21 20,21 present two time ... I mean duplicate row then also thos query will consider it as a symmetrical pair...
Best approach 🔥🔥🔥
Thanks Bhai 🙂🙏
mahaan ho bhai mahaan...
@@himanshuchauhan3267 thank you 😊🙏
Bhai koi other way bhi hai ky aisey solv krne ka
Hosakta hai but easy way hai case use karke
Keep up the good work 😊
@@user-th5mq7so6i 😊 thankyou
didn't understand the COUNT() part...if any pair having count = 1 then it can also be a pair ??
In symmetric pair one pair need to come two times like 20 21 and 21 20 both are symmetric pair
bhai yaar aapne jo logic lagaya usme mano id 6 repeat hoga 3 tym to usme row_num 1,2,3 aayega .. to usme toh id - row_num =0 nahi hoga ..
@@professor_DJ_010 sare 6 consecutive nhi hoga bs ek hoga
@@professor_DJ_010 duplicate nhi aayega
bhut ache se samjhaye bhaiya ji
@@professor_DJ_010 thankyou 😊