Skip to content

SQL queries and resources for working with the Stack Overflow 10GB database provided by Brent Ozar.

Notifications You must be signed in to change notification settings

lnvaldez/stackoverflow-sql-queries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Stack Overflow 10GB Database Queries
Stack OverflowMicrosoftSQLServer

This repository contains SQL queries and resources for working with the Stack Overflow 10GB database provided by Brent Ozar.

Prerequisites

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.

Downloading the Database

You can download the Stack Overflow 10GB database from Brent Ozar's website. Go to Brent Ozar's Stack Overflow Database for download instructions.

Loading the Database

  1. After downloading, extract the database files.
  2. Attach the database files to your SQL Server instance.
  3. Configure any necessary server settings or file paths as required.

Database Schema

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

About

SQL queries and resources for working with the Stack Overflow 10GB database provided by Brent Ozar.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages