Skip to main content

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.

1 vote
1 answer
211 views

Most elegant one-liner to generate sqlite INSERTs

Challenge You find yourself in a bash terminal, and want to do some simple tests on sqlite3. So you issue the following command: ...
ChrisB's user avatar
  • 119
7 votes
2 answers
227 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 ...
JakeDanzels's user avatar
8 votes
3 answers
638 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 ...
bigyihsuan's user avatar
  • 10.2k
5 votes
1 answer
347 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, ...
ggPeti's user avatar
  • 211
13 votes
0 answers
538 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 ...
aloisdg's user avatar
  • 2,077
20 votes
10 answers
3k 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: ...
Dimgold's user avatar
  • 353
21 votes
16 answers
7k 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 ...
Michael B's user avatar
  • 1,631