Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql]

Use for questions related to SQL usage in the StackExchange codebase as well as custom queries written by external users in Data Explorer.

2
votes
1answer
1k views

Any way to auto-format SQL in Stack Exchange Data Explorer?

One really nice feature of Toad (database administration tool) is the ability to auto-format your SQL (usually with CTRL + SHIFT + F). Manually formatting SQL greatly increases readability, but takes ...
1
vote
1answer
372 views

SELECT TOP without ORDER BY [closed]

Using the Stack Exchange Data Explorer: SELECT TOP 5 id as PostId,CreationDate FROM Posts order by id desc gives me: SELECT TOP 5 id as PostId,CreationDate FROM Posts order by id asc gives me: ...
3
votes
1answer
35 views

Problems filtering rows with Stack Exchange Data Explorer (SEDE)

I want to study how people behave where they are near to get a Tag Badge, so I need to: Extract all the ID of users who have won a Tag Badge in a certain period of time. See what Tag Badge they have ...
2
votes
1answer
71 views

Adding a text field for string input in Data Explorer

I would like to run a query that takes a textfield as an input. I know it works fine with int like so: DECLARE @UserId int = ##UserId## ... WHERE Posts.OwnerUserId = @UserId But how can I do ...
1
vote
1answer
97 views

Data Explorer query to find answers of specific user based on a keyword

I'm looking for SQL query to use within Data Explorer, to bring back all my answers (per site, from only one site at a time) with my userid and with a particular keyword, in the body of my answers. I ...
4
votes
1answer
81 views

Potential inconsistency in Stack Overflow database dump

I would like to determine on average how long it takes until a question gets its first/accepted answer. I am running this SQL query (for first answer) in data.stackexchange.com: SELECT AVG(CAST(...
7
votes
2answers
216 views

Why does data explorer not support ILIKE, SIMILAR TO, or regular expressions (~)?

Why does the data explorer not support ILIKE, SIMILAR TO, or regular expressions ~? Talking to the devs: Would it be possible to add that functionality?
1
vote
0answers
32 views

In case I do not get answers tools for this question and wish to program/ automate for this, which site should I go and post to? [duplicate]

Consider this question on Super User: Strategy & Steps to whitelist Chrome cookies for Sites whose logins & passwords are saved? Essentially, mapping an exported CSV list towards creating a ...
5
votes
2answers
956 views

Which tools and libraries are used for testing by StackOverflow developers? [duplicate]

Here you can find details about the software and hardware on which the site is built. I am wondering do developers write any automation tests (unit/functional/scenario) and what kind of tools/...
-4
votes
2answers
849 views

Allow some basic HTML formating inside query results or interpret MarkDown

I wrote this query and Markdown inside third column wasn't converted to HTML. So I converted the closes reasons to HTML and it appears that the Javascript doesn't make the rows look parsed. As there ...
5
votes
2answers
102 views

How to use Data Explorer to find the most prolific closers on a site?

Goal: Make the list of Top 50 users who closed most questions on a site. This means the questions that actually got closed, not pending close votes/flags. Deleted questions are excluded from ...
3
votes
2answers
96 views

How I can get questions where the body is the same as the title?

It is know that many questions have the same body and title, So I wanted to create a query to show them all, but this don't work : select Posts.id as [Post Link], -- Question title. Count(...
2
votes
1answer
73 views

How to count the most frequent CloseReasonTypes per posts in the data-explorer?

I started to compose this query and I find it's difficult to see why the question should be closed. select TOP ##Limit:int?38369## -- The maximum value the hardware can handle. Posts.Id as [...
2
votes
1answer
109 views

Querying for reputation of the commenter and its addressee using SEDE

How can I modify this Data Explorer query for the case when user of the comment is same as the poster, then the query should look for the tagged user in the comment and print the tagged user ...
0
votes
1answer
86 views

Querying for name and rep of commenter and post OP using SEDE

I am new to T-SQL and would greatly appreciate help on the following query on the Stack Exchange Data Explorer. For a given comment I need to display the username and reputation of whoever posted the ...
0
votes
1answer
293 views

How can i generate SQL DEMO online temporarily base ?

I have some query in SQL data retrieving related so how can i display in stackoverflow, any one know me. please .
10
votes
2answers
12k views

How to make tables in good format in asking questions here (which is understandable by others)? [duplicate]

When we paste a table from a note pad or word or any other source its not coming in a good table format in this Stack Overflow question editor/text box space. My question is how do you make an ...
19
votes
0answers
167 views

Data Explorer execution plans are no longer available because SHOWPLAN permission is denied [closed]

I noticed after a recent maintenance downtime that now I get the following message when trying to include an execution plan with a query: SHOWPLAN permission denied in database 'StackOverflow'. ...
5
votes
1answer
83 views

Why does the data explorer have inaccessible columns?

Why does the data explorer have columns that do not return visible results? For example, the column Votes.UserId does not return any information. This makes sense to me. I just don't understand why ...
2
votes
1answer
337 views

How to ask SQL questions with table definitions and example code?

I am always struggling when asking SQL questions. How are we supposed to ask questions related to SQL including table definitions and code examples? Is there a jsfiddle.net equivalent for sql that ...
4
votes
1answer
140 views

Trouble with fetching data

I'm trying to query the following data from stackexchange: Fetch all the questions asked about Android, in past five years, and display post's id (a.iD), associated tags (a.Tags), for the person ...
4
votes
1answer
587 views

SQL Query not returning hyperlink on data.stackexchange.com

I am basically a C programmer but I started on SQL today with the only purpose of fiddling around the data available on data.stackexchange.com. So please bear with me if my question is naive or ...
7
votes
1answer
320 views

Creating beautiful tables [duplicate]

Possible Duplicate: Is there any markdown to create tables? How to format SQL tables in a Stack Overflow post? I was wondering how users are able to create beatiful tables of how their sql ...
44
votes
1answer
1k views

What does SE use to calculate reputations? SQL aggregate functions? A manual method?

I want to implement something similar to Stack Exchange's reputation system. What would be the better practice: using an SQL aggregate function to recalculate every time it changes, or storing ...
10
votes
2answers
285 views

A query to get all posts that count for Archaeologist and Excavator

I've been playing with data-explorer to peruse stackoverflow more and learn some t-sql. I managed to write this query, which lists out all posts the user has edited and then shows a difference in ...
10
votes
5answers
826 views

Ethics for SQL insert queries vulnerable to SQL injection [closed]

I've come across and helped lots of people with SQL INSERT queries, where nothing about the values being from the user and form input is being mentioned. The main point of the questions vary from ...
4
votes
2answers
111 views

Stack Exchange Data Queries - Get URL of Site Query Ran Against

I've made myself a little query on the stack exchange data explorer which gets a leader board for the top comments on the site, and the URL for the post that the comment was posted on. This query ...
0
votes
1answer
74 views

Is the following question type OK in Stack Overflow? [duplicate]

Possible Duplicate: How to determine if I should post on Stack Overflow or Server Fault about SQL I want to describe how I am handling a SQL (MySQL) query, and want to know if there are other ...
6
votes
1answer
260 views

SQL Server 2011 vs. SQL Server Denali [closed]

I'm wondering what the process should be for guiding the tag people should be using for the next version of SQL Server. With CTP3 now out in the public's hands, I expect StackOverflow, ServerFault and ...
6
votes
1answer
278 views

Stack Exchange SQL samples

I swear I saw this on one of Stack Exchange sites, but can't find it. There was a section full of SQL query samples, like which users got most upvotes for last 2 weeks and so on. Does anyone know ...
8
votes
2answers
439 views

Why is there no syntax highlight for SQL merge statements? [duplicate]

It seems, that Stack Overflow doesn't recognise the SQL:2003/SQL:2008 MERGE statement, as can be seen in my answer here: Oracle: Updating a table column using ROWNUM in conjunction with ORDER BY ...
3
votes
1answer
115 views

Links to all my questions?

Is there a way to get hold of a parsable list of links (or if that's not possible, IDs) to all my questions to all my answers preferably without using the data dump?
0
votes
1answer
2k views

What SQL query does stackoverflow use to retrieve a question and all its answers in order?

According to this, stackoverflow uses one table for both questions and answers. This design seems somewhat unusual. What SQL query does stackoverflow use to retrieve question #123456 and all its ...
53
votes
15answers
2k views

Can we become our own “Northwind” for teaching SQL / databases?

In the Microsoft ecosystem there are some standard databases like Northwind ... The Northwind Traders sample database contains the sales data for a fictitious company called Northwind Traders, ...
0
votes
1answer
169 views

Using the data dump without MS SQL? [duplicate]

Possible Duplicate: Scripts to convert data-dump to other formats I was wondering how I can use the data dump to query for answers offline (on a MacOS box)? - I recently saw some people using it ...
18
votes
2answers
2k views

Rejection of text containing SQL statements

OK, I've been having weird problems for the last 1/2 hour trying to post an answer to a database-related question on StackOverflow, and I keep getting this result (on Firefox 3.6) The connection ...
2
votes
2answers
410 views

SQL Syntax highlighter doesn't recognized double-dash comment syntax [duplicate]

-- this is a comment UPDATE Employees SET fired = 1 WHERE noiseLevelInDB > 80
0
votes
3answers
287 views

SQL users' upvotes

I am not trying to be rude, at all, but I just have a quick question. Maybe some stats can back me up, but this is my personal feeling. Why do SQL users upvote less than others? I answer a variance ...
-3
votes
3answers
335 views

Auto generated create table snippets for sample data in specific format

Edit: try again. In a SQL related question, when the OP gives a code table such as: Department | Category | 0001 | A | 0002 | D | 0003 | A | 0003 ...