What are some cool SQL queries, or tricks that you might not think of being able to do with SQL?
-
I just saw someone who generated a histogram of relative frequencies for categorical variables in pure SQL with a substring of ']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]' based on the frequency of the variable, which got me wondering, what are some other cool things you can do with your queries?
-
Answer:
I once saw a SQL query that would solve any sudoku puzzle. But if you want see a lot of really cool SQL tricks, pick up a copy of Joe Celco's SQL for Smarties.
Kevin Edward Kline at Quora Visit the source
Other answers
Check out this question: What are some interesting SQL queries?
Benjamin Darfler
Recursion is what many think is not possible in SQL, and tend towards using Cursors or WHILE loops. But CTE (Common Table Expressions) feature introduced in SQL Server 2005 allows you to create recursive queries, and use it extensively and regularly. Here are some examples: 1. Generating a Factorial series: ;with fact as ( select 1 as fac, 1 as num union all select fac*(num+1), num+1 from fact where num<12) select fac from fact where num=5 2. Generating a Fibonacci Series ;with fibo as ( select 0 as fibA, 0 as fibB, 1 as seed, 1 as num union all select seed+fibA, fibA+fibB, fibA, num+1 from fibo where num<12) select fibA from fibo Check these and more at: http://sqlwithmanoj.com/2011/05/23/cte-recursion-sequence-dates-factorial-fibonacci-series/
Manoj Pandey
Related Q & A:
- What are some cool science fair projects?Best solution by Yahoo! Answers
- What are some cool cheats you can do on The Sims 2?Best solution by Yahoo! Answers
- What are some cool jobs out there?Best solution by Yahoo! Answers
- What is some cool medical stuff?Best solution by Yahoo! Answers
- What are some cool tricks to do when surfing?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.