This repository contains SQL queries and resources for working with the Stack Overflow 10GB database provided by Brent Ozar.
To use the Stack Overflow database, you will need:
- SQL Server Management Studio (SSMS) or another SQL database management tool.
- Sufficient disk space (approximately 10GB) and system resources.
You can download the Stack Overflow 10GB database from Brent Ozar's website. Go to Brent Ozar's Stack Overflow Database for download instructions.
- After downloading, extract the database files.
- Attach the database files to your SQL Server instance.
- Configure any necessary server settings or file paths as required.
The Stack Overflow database includes tables such as Users, Posts, Comments, and Votes. These tables contain various fields related to Stack Overflow activity.
Queries - queries
Query 1 - query01
Retrieves the DisplayName, Location, and Reputation of users from the Users table, ordered by Reputation in descending order.
csv
Query 2 - query02
Retrieves the Title of posts and the DisplayName of users who authored those posts, filtering out posts where Title is not null.
csv
Query 3 - query03
Calculates the average Score of posts authored by each user (DisplayName), sorting users by their average score in descending order.
csv
Query 4 - query04
Retrieves the DisplayName of users who have made more than 100 comments in total.
csv
Query 5 - query05
Updates the Location column of users to 'Desconocido' (Unknown in Spanish) where Location is null or empty.
csv / rpt
Query 6 - query06
Deletes comments made by users whose Reputation is less than 100, displaying the number of deleted comments after execution.
rpt
Query 7 - query07
Retrieves DisplayName of users along with the total count of their posts (TotalPosts), comments (TotalComments), and badges (TotalBadges).
csv
Query 8 - query08
Retrieves the top 10 posts by Title and Score from the Posts table, ordered by Score in descending order.
csv
Query 9 - query09
Retrieves the most recent 5 comments with their Text and CreationDate from the Comments table, ordered by CreationDate in descending order.
csv