Questions tagged [sql]

For challenges related to structured query language (SQL), including but not limited to short sql code, query result challenges or fixing invalid queries. Note that challenges that require the answers to be in a specific language are generally discouraged.

Filter by
Sorted by
Tagged with
7 votes
2 answers
150 views

In as few bytes as possible in t-sql, return 100 rows containing the phrase 'Have a great Christmas'

In as few bytes as possible in t-sql, return 100 rows containing the phrase 'Have a great Christmas' 92 (I think) to beat :D ...
user avatar
8 votes
3 answers
579 views

SELECT ALL FROM SelectQL WHERE (answer="short" OR NOT length=10000)

I've invented an SQL-like language. Let's call it SelectQL. You can't INSERT anything, you can only SELECT, and I don't have the ...
user avatar
  • 2,973
5 votes
1 answer
290 views

What is the longest possible DDL query in PostgreSQL?

We all know and love the corpulent DDL expressions one can write in PostgreSQL with wording like DEFERRABLE INITIALLY DEFERRED, ...
user avatar
  • 211
12 votes
0 answers
391 views

Tips for Golfing in SQLite?

I was looking for this page to help me enhance my first answer with SQLite, but I couldnt find one. So here we are! What general tips do you have for golfing in SQLite? I'm looking for ideas that can ...
user avatar
  • 1,947
19 votes
10 answers
1k views

SQL select number ranges

I found it quite hard to achieve a range of numbers as rows in MySQL. For example the range 1-5 is achieved by: ...
user avatar
  • 333
17 votes
16 answers
4k views

Tips for Golfing in T-SQL

What general tips do you have for golfing in T-SQL? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to T-SQL. Please post one tip per ...
user avatar
  • 1,551