Questions tagged [sql]
GENERAL SQL QUESTIONS ARE OFF-TOPIC. Use this tag for questions related to SQL usage in the Stack Exchange codebase as well as custom queries written by external users in Data Explorer.
44 questions
2
votes
1
answer
152
views
How to get tags of questions answered by a user in Stack Exchange Data Explorer
I can't solve this problem: using a remote DBMS from the Stack Overflow site (URL: http://data.stackexchange.com/stackoverflow/query/new). Write a SQL query that displays the names of users with a ...
4
votes
1
answer
89
views
Why doesn't LIMIT work in Stack Exchange Data Explorer? [duplicate]
For some reason this isn't working in Data Explorer:
select ownerUserId, creationDate from posts LIMIT 1
I'm getting
Line 1: Incorrect syntax near '1'.
What am I doing wrong?
7
votes
1
answer
85
views
How to escape single quotes in SEDE ##keyword## search?
The interactive SQL explorer interface for https://data.stackexchange.com/ has a convenient feature where you can request user input in a text field using syntax like ##variable##. But the ...
4
votes
3
answers
97
views
Find questions where any of the tags are in the title or body?
I would like to find posts where any of the tags are present in the title or body of the question, e.g. Python and C# are the tags and title is Fix my Python Problem?
SELECT TOP 10
Posts.Id,
Posts....
-6
votes
1
answer
256
views
What post query does Stack Overflow fire to get a question's details with answers, tags, votes, etc.?
As I was reading to get a question or post below, a query may be fired by Stack Overflow:
SELECT * # Replace the actual fields
FROM posts
WHERE (Id = {POST_ID}) OR (ParentId = {POST_ID})
ORDER BY ...
2
votes
1
answer
916
views
How do you join between Posts and Users in the Stack Overflow database?
I'm trying to join between stackoverflow.com's dataset Posts and Users files and I'm having trouble. I want to add the user profile of the question poster to a Post.
Do I use User.AccountId or User....
1
vote
3
answers
160
views
How do I modify this query to search for specific tags?
I am forking this query, which essentially outputs the time between the question being asked and the answer being given. However, I am trying to modify the query to only search for java. I tried this:
...
2
votes
1
answer
2k
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 ...
4
votes
1
answer
65
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 ...
3
votes
1
answer
104
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 ...
2
votes
1
answer
166
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
1
answer
83
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(...
11
votes
2
answers
384
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
0
answers
35
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
2
answers
2k
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
2
answers
1k
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 ...
9
votes
2
answers
210
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 ...
4
votes
2
answers
118
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
1
answer
92
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 [Post ...
2
votes
1
answer
112
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
1
answer
106
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
1
answer
391
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 .
21
votes
2
answers
21k
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
0
answers
183
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
1
answer
88
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
1
answer
352
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
1
answer
151
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 ...
5
votes
1
answer
637
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
1
answer
348
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 ...
46
votes
1
answer
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
2
answers
311
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
5
answers
894
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
2
answers
133
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
1
answer
86
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
1
answer
274
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
1
answer
290
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
2
answers
529
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
1
answer
124
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
1
answer
3k
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 ...
55
votes
15
answers
3k
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, which ...
0
votes
1
answer
173
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 ...
19
votes
2
answers
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 ...
0
votes
3
answers
376
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
3
answers
354
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 ...