GTA: SQL Bay City Ops
Your Interactive SQL Training Dossier. From rookie to seasoned data detective, master SQL in the perilous streets of Bay City.
Welcome to the SQL Bay City Challenge!
This is a comprehensive SQL learning guide structured as an interactive game set in the fictional Bay City. You'll progress from basic SQL commands in the "Bootcamp" to solving complex criminal cases as a detective in "Bay City Blues."
This guide is designed for:
- Beginners looking to learn SQL fundamentals in an engaging way.
- Intermediate users wanting to practice complex queries and problem-solving.
- Fans of GTA-style narratives.
Prerequisites:
- An Azure SQL Database (or any SQL Server compatible database).
- A SQL client tool (see "Recommended Tools for Accessing the Database" section below).
- Successful execution of the
GTA_SQL_Academy_with_Bootcamp_met data.sql
script (provided elsewhere in this project) to set up your database. Make sure your database is populated before starting the challenges.
Let's get started, Agent!
Table of Contents
SQL Login Credentials & Recommended Tools
Below are the SQL login credentials for the gtareader
user, which has read-only access to the GTA
schema within the Courses
database.
- Server Name:
skills4it.database.windows.net
- Database Name:
Courses
- Login (Username):
gtareader
- Password:
StrongPass!2025
Recommended Tools for Accessing the Database
To connect to your Azure SQL Database and execute the queries from this guide, you can use several excellent tools. Here are a few popular choices:
-
Azure Data Studio:
- Description: A free, cross-platform (Windows, macOS, Linux) database tool for data professionals. It's lightweight and offers a modern editor experience with IntelliSense, code snippets, source control integration, and an integrated terminal.
- Pros: Excellent for Azure SQL Database, modern interface, great for query writing and result visualization, built-in Jupyter Notebooks support.
- How to Connect:
- Open Azure Data Studio.
- Click "New Connection" or the plug icon in the SERVERS view.
- Connection type: Microsoft SQL Server.
- Server:
skills4it.database.windows.net
- Authentication type: SQL Login.
- User name:
gtareader
- Password:
StrongPass!2025
- Database:
Courses
(or leave as
and select later). - Enable "Encrypt connection" (usually default and recommended).
- Consider enabling "Trust server certificate" if you encounter SSL issues for initial local connections, but for production, properly configured certificates are better.
- Click "Connect".
-
SQL Server Management Studio (SSMS):
- Description: A more comprehensive, Windows-only integrated environment for managing any SQL infrastructure.
- Pros: Very powerful, extensive administrative features, familiar to many SQL Server DBAs.
- How to Connect:
- Open SSMS.
- Server type: Database Engine.
- Server name:
skills4it.database.windows.net
- Authentication: SQL Server Authentication.
- Login:
gtareader
- Password:
StrongPass!2025
- Click "Connect".
- You might need to click "Options >>" and specify "Connect to database:" as
Courses
on the "Connection Properties" tab. Ensure "Encrypt connection" is checked.
-
Command-Line Tools:
sqlcmd
: A command-line utility that comes with SQL Server. Useful for scripting.sqlcmd -S skills4it.database.windows.net -U gtareader -P "StrongPass!2025" -d Courses -N -C # Type your query and then GO
mssql-cli
: A modern, cross-platform command-line tool with auto-completion.mssql-cli -S skills4it.database.windows.net -U gtareader -P "StrongPass!2025" -d Courses --encrypt verify-full
-
VS Code with SQL Server (mssql) Extension:
- Description: If you use Visual Studio Code, the "SQL Server (mssql)" extension by Microsoft provides a rich experience.
- Pros: Convenient if VS Code is your primary editor; good IntelliSense and query execution.
- How to Connect: Install the extension, then use the command palette (
Ctrl+Shift+P
orCmd+Shift+P
) to "MS SQL: Connect" and follow the prompts similar to Azure Data Studio.
General Connection Steps (varies slightly by tool):
- Open your chosen tool.
- Find "New Connection" / "Connect to Server".
- Server Name/Host:
skills4it.database.windows.net
- Authentication Type: "SQL Server Authentication".
- Login/User name:
gtareader
- Password:
StrongPass!2025
- Database (Optional but Recommended):
Courses
. - Encryption: Ensure it's enabled. For Azure SQL, this is typically required.
- Click "Connect".
Once connected, you can open a new query window/editor and start running the SQL statements from the guide.
Important Security & Permissions Note:
- The
gtareader
user is configured withSELECT
permissions only on theGTA
schema. This is a security best practice. - With these credentials, you cannot perform operations that modify the database structure or data (e.g.,
CREATE TABLE
,INSERT
,UPDATE
,DELETE
). - To execute DDL or DML statements (like setting up the "Bay City Blues" tables and initial data), you will require credentials for a user with higher privileges (e.g.,
db_owner
). The providedGTA_SQL_Academy_with_Bootcamp_met data.sql
script should be run by such a user.
GTA: SQL Bay City Hustle β Bay City SQL Bootcamp
The neon glow of Bay City reflects in your eyes. It's a city of a million stories, and even more data points. Before you dive headfirst into the criminal underworld or the high-stakes corporate espionage that defines this town, you need to become fluent in its digital language: SQL. This isn't just about queries, rookie; it's about survival, outsmarting your rivals, and carving out your legend. This SQL Bootcamp is your first step. Each directive here sharpens your skills, preparing you for the real hustle.
DATABASE SCHEMA OVERVIEW (Your Primary Intel Feed)
Before you query, you must understand your sources. This is a simplified manifest of your key data feeds:
Table | Intel Type | Critical Fields (Examples) |
---|---|---|
GTA.Citizens | Profiles: Targets, Assets, Informants | CitizenID (PK) , Name , Alias , Profession , WantedLevel |
GTA.Vehicles | Transport: Getaway Cars, Stolen Goods, Assets | VehicleID (PK) , OwnerID (FK) , Type , Brand , Speed , IsStolen |
GTA.Missions | Ops: Contracts, Heists, Covert Jobs | MissionID (PK) , Title , Difficulty , Reward , Location |
GTA.Assignments | Operative Activity: Links Citizens to Missions | CitizenID (FK) , MissionID (FK) , Completed , TimeSpent |
GTA.Weapons | Arsenal: Tools of the Trade | WeaponID (PK) , Name , Type , DamagePerShot , Price |
GTA.CitizenWeapons | Loadouts: Who's carrying what | CitizenID (FK) , WeaponID (FK) , IsEquipped |
GTA.Properties | Real Estate: Safehouses, Fronts, Lairs | PropertyID (PK) , OwnerID (FK) , PropertyName , PropertyType , MarketValue , GarageSlots |
GTA.Factions | Organizations: Gangs, Corps, Secret Societies | FactionID (PK) , Name , LeaderID (FK) , Turf , DefaultRelation |
GTA.CitizenFactionMembership | Allegiances: Who's in with whom | CitizenID (FK) , FactionID (FK) , Rank , PersonalReputation |
(For the "Bay City Blues" detective challenge, additional BCPD_
tables will be introduced later.)
SELECT & FROM β Scanning the Grid
Handler's Briefing: "Alright, Agent, eyes open. In Bay City, information isn't just power; it's ammunition. SELECT
is your targeting reticle β it tells the system what data you're after. FROM
is your GPS β it points to the data silo, the TableName
, where that intel is stashed."
Syntax:
SELECT column1, column2 -- Specify the intel fields you need
FROM GTA.TableName; -- Specify the data source
Example: City-Wide Persons of Interest Scan
"When tall buildings block your line of sight, you fire up the cityβs master cameras. Let's get a quick thermal scan of the city. Show me names and current heat levels from the Citizens
databank."
SELECT Name, WantedLevel
FROM GTA.Citizens;
β Quick Mission: Asset Roster Compilation (Difficulty: β)
- Objective: Central command needs a basic roster. List all known citizen
Name
s and their registeredProfession
s. This could be your first lead, or your first target. - Directive: Query the
GTA.Citizens
table.
Declassified Solution & Handler's Feedback
SELECT Name, Profession
FROM GTA.Citizens;
"Good pull, Agent. Basic, but essential. Knowing who's who is step one."
WHERE β Filtering Suspects
Handler's Briefing: "The city's data stream is a firehose, Agent. You can't drink it all. The WHERE
clause is your precision filter. You don't need the census report; you need the troublemakers, the vulnerabilities, the opportunities. This is how you cut through the noise."
Syntax:
SELECT * -- Or specific columns
FROM GTA.TableName
WHERE condition; -- Your filter criteria (e.g., Age < 25, WantedLevel > 3, Profession = 'Fixer')
Example: High Threat Individuals
"Filter the Citizens
databank. I only want eyes on individuals with a WantedLevel
greater than 1. These are the ones making waves."
SELECT *
FROM GTA.Citizens
WHERE WantedLevel > 1;
β Quick Mission: Youth Division Profiling (Difficulty: β)
- Objective: Intel chatter suggests an uptick in activity among the city's younger elements. Retrieve full dossiers (
*
) for all citizens under 25. - Directive: Query
GTA.Citizens
.
Declassified Solution & Handler's Feedback
SELECT *
FROM GTA.Citizens
WHERE Age < 25;
"Interesting. A lot of fresh faces in that list. Keep an eye on them."
ORDER BY β Ranking the Danger
Handler's Briefing: "Data dumps are messy. To make strategic decisions, you need intel sorted. Fastest escape routes? Most lucrative targets? Highest operational risks? ORDER BY
is your analyst, bringing method to the madness. ASC
for ascending, DESC
for descending."
Syntax:
SELECT * -- Or specific columns
FROM GTA.TableName
ORDER BY column ASC|DESC; -- Sort by this column, either A-Z/0-9 (ASC) or Z-A/9-0 (DESC)
Example: Hot Wheels Inventory
"I need a list of all registered Vehicles
. Show me their Brand
, Type
, and Speed
. Fastest ones at the top."
SELECT Brand, Type, Speed
FROM GTA.Vehicles
ORDER BY Speed DESC;
β Quick Mission: Vehicle Performance Tiers (Difficulty: ββ)
- Objective: Your getaway driver needs options. List all vehicle
Type
s,Brand
s, and theirSpeed
, sorted from the slowest clunker to the fastest street demon. - Directive: Query
GTA.Vehicles
.
Declassified Solution & Handler's Feedback
SELECT Type, Brand, Speed
FROM GTA.Vehicles
ORDER BY Speed ASC; -- ASC for slowest to fastest
"Good. Now we know what we're working with if we need a subtle exit versus a bat-out-of-hell scenario."
Pro Tip:
ORDER BY
is often one of the last clauses processed in a query. If you're sorting a very large dataset, it can impact performance. Use it wisely!
GROUP BY β Squad-Level Insights
Handler's Briefing: "Sometimes the individual brushstrokes don't matter as much as the whole painting. How many ops has each cell completed? What's the average take per type of job? GROUP BY
rolls up your raw intel into actionable summaries. This is how you see the bigger picture, Agent."
Syntax:
SELECT column_to_group_by, AGGREGATE_FUNCTION(column_to_analyze) AS summary_value
FROM GTA.TableName
GROUP BY column_to_group_by;
(Remember, AGGREGATE_FUNCTION
could be COUNT()
, SUM()
, AVG()
, MIN()
, MAX()
.)
Example: Operative Workload Assessment
"Let's see the operational tempo. COUNT
how many Assignments
each CitizenID
has on their docket."
SELECT CitizenID, COUNT(*) AS TotalAssignments
FROM GTA.Assignments
GROUP BY CitizenID;
β Quick Mission: Vehicle Fleet Analysis (Difficulty: ββ)
- Objective: Intel suggests some citizens are more... acquisitive than others. How many vehicles are registered to each citizen?
- Directive: You'll need to link
GTA.Citizens
(for names) toGTA.Vehicles
. Show citizenName
and their vehicleCOUNT
.
Declassified Solution & Handler's Feedback
SELECT
C.Name,
COUNT(V.VehicleID) AS NumberOfVehiclesOwned
FROM
GTA.Citizens C
LEFT JOIN -- Important to see citizens even if they own 0 vehicles
GTA.Vehicles V ON C.CitizenID = V.OwnerID
GROUP BY
C.CitizenID, C.Name -- Group by primary key and displayed name
ORDER BY
NumberOfVehiclesOwned DESC;
"Some folks have quite the collection. Might be enthusiasts, or they might be running a chop shop. Good to know."
BONUS: Aggregates β The City at a Glance
Handler's Briefing: "These are your quick-scan tools, Agent. Need a headcount? COUNT()
. Total cash flow? SUM()
. Average operational speed? AVG()
. Lowest price for an asset? MIN()
. Highest threat level? MAX()
. Master these, and you'll have the city's pulse at your fingertips."
COUNT()
- Number of recordsSUM()
- Total of a numeric fieldAVG()
- Average of a numeric fieldMIN()
- Smallest valueMAX()
- Largest value
Example: City-Wide Vehicle Performance Benchmark
"What's the average top Speed
of all Vehicles
in our database?"
SELECT AVG(Speed) AS AverageCityVehicleSpeed
FROM GTA.Vehicles;
β Quick Mission: Peak Threat Assessment (Difficulty: β)
- Objective: The brass wants a sitrep. What's the absolute highest
WantedLevel
currently active in Bay City? - Directive: Query
GTA.Citizens
.
Declassified Solution & Handler's Feedback
SELECT MAX(WantedLevel) AS PeakWantedLevel
FROM GTA.Citizens;
"Okay, so that's our current public enemy number one, at least by the BCPD's books. Noted."
SQL Operations: Full Training Missions π―
Handler's Briefing: "Bootcamp's a walk in the park, Agent. Now the real work begins. These next scenarios aren't drills; they're simulations of the kind of high-stakes data dives you'll be running daily on the gritty streets of Bay City. Each mission will push your SQL combat skills further. Failure is not an option when lives β or millions in untraceable crypto β are on the line."
MISSION 1: Suspect Scanner
- Objective (Difficulty: ββ): Sharpen your
WHERE
clause skills for targeted data acquisition. - Incoming Encrypted Transmission (Story): "Handler here. Our top-tier netrunner, Claudia βCodewitchβ Trejo, just punched a hole in the BCPD's archaic suspect database. She's streaming us a raw feed, but it's unfiltered β the entire city's watch list. Codewitch has a script auto-flagging any individual with a
WantedLevel
of 2 or higher. These aren't just petty criminals, agent; these are individuals who've made significant noise. Your first task: isolate these high-priority targets from the data stream. We need their fullName
, knownAlias
, and confirmedWantedLevel
for immediate tactical assessment. They could be potential assets, immediate threats, or simply pawns in a much larger game. Move fast; data this fresh doesn't stay exclusive for long." - Your Assignment: Write a SQL query to extract all suspects with a
WantedLevel
of 2 or more. The dossier must include the suspect'sName
,Alias
, and currentWantedLevel
.
Declassified Solution
SELECT Name, Alias, WantedLevel
FROM GTA.Citizens
WHERE WantedLevel >= 2;
MISSION 2: Vehicle Watchlist
- Objective (Difficulty: βββ): Master
JOIN
operations to correlate data across tables and refine withWHERE
. - Intel Transmission (Story): "Jakeyl βBeardstormβ Millan, one of our... 'asset recovery specialists,' is on the prowl. He's tracking a shipment of high-end stolen vehicles. The manifest is a mess, but he needs a clean list matching each boosted ride to its last known 'owner' β likely the thief. Time is critical; these cars will be on a freighter by dawn if he doesn't move fast."
- Your Assignment: Construct a query that returns the
Name
of the suspect (fromGTA.Citizens
), theType
of vehicle, and theBrand
of all vehicles marked as stolen (IsStolen = 1
inGTA.Vehicles
).
Declassified Solution
SELECT
C.Name AS SuspectName,
V.Type AS VehicleType,
V.Brand AS VehicleBrand
FROM
GTA.Citizens C
JOIN -- Inner join implies the vehicle must have an owner in the Citizens table
GTA.Vehicles V ON C.CitizenID = V.OwnerID
WHERE
V.IsStolen = 1;
Pro Tip: When joining tables, always specify which table a column belongs to if the column name exists in multiple tables (e.g.,
C.CitizenID
,V.OwnerID
). Using table aliases (C
,V
) keeps your queries concise.
MISSION 3: Reward Tracker
- Objective (Difficulty: βββ): Utilize
GROUP BY
in conjunction withSUM
andORDER BY
for financial intelligence. - Intel Transmission (Story): "Frederick βFreddie Finesseβ is a man who appreciates the bottom line. He's reviewing his crew's recent performance β specifically, the payout from all completed missions. He needs to know who the top earners are. Bonuses are on the line, and so is Freddie's patience with underperformers."
- Your Assignment: Write a SQL query that displays:
- The
Name
of each operative (GTA.Citizens
). - The total
SUM
ofReward
they've earned from completed missions (linking throughGTA.Assignments
toGTA.Missions
).
ORDER BY
their total earnings from highest to lowest. - The
Declassified Solution
SELECT
C.Name AS OperativeName,
SUM(M.Reward) AS TotalEarningsFromCompletedMissions
FROM
GTA.Citizens C
JOIN
GTA.Assignments A ON C.CitizenID = A.CitizenID
JOIN
GTA.Missions M ON A.MissionID = M.MissionID
WHERE
A.Completed = 1 -- Critical filter for only completed missions
GROUP BY
C.CitizenID, C.Name -- Group by primary key and displayed name
ORDER BY
TotalEarningsFromCompletedMissions DESC;
MISSION 4: Mission Speed Metrics
- Objective (Difficulty: ββββ): Employ
GROUP BY
with multiple aggregate functions (MIN
,MAX
,COUNT
) for operational analysis. - Intel Transmission (Story): "Kevin βSunset Sniperβ Gagante lives by the clock. Efficiency is everything. He needs a performance review of his agents. Some move like ghosts, swift and silent; others... well, they get the job done, eventually. He needs to know who's the quickest, who's the most methodical (read: slowest), and the total number of completed ops for each agent."
- Your Assignment: For each operative who has successfully completed missions, your report must return:
- Their
Name
(GTA.Citizens
). - The
COUNT
of missions they'veCompleted
. - Their fastest mission completion time (
MIN(TimeSpent)
fromGTA.Assignments
). - Their slowest mission completion time (
MAX(TimeSpent)
fromGTA.Assignments
).
TimeSpent
is not null. - Their
Declassified Solution
SELECT
C.Name AS OperativeName,
COUNT(A.MissionID) AS NumberOfMissionsCompleted,
MIN(A.TimeSpent) AS FastestCompletionTime_Minutes,
MAX(A.TimeSpent) AS SlowestCompletionTime_Minutes
FROM
GTA.Citizens C
JOIN
GTA.Assignments A ON C.CitizenID = A.CitizenID
WHERE
A.Completed = 1 AND A.TimeSpent IS NOT NULL -- Filter for completed and timed missions
GROUP BY
C.CitizenID, C.Name
ORDER BY
NumberOfMissionsCompleted DESC, C.Name; -- Optional: Order by most active
MISSION 5: Elite Agent Filter
- Objective (Difficulty: ββββ): Master the
HAVING
clause to filter grouped results based on aggregate conditions. - Intel Transmission (Story): "A whisper on the dark net, Agent. Emilya βE-Mageβ Illeeva, a legendary figure who pulls strings from the deepest shadows, is forming a new black-ops unit. Her recruitment standards are... exacting. She's only interested in operatives who have (1) successfully
Completed
at least 2 missions, AND (2) raked in aSUM
of $4000 or more in total rewards. No rookies, no small-timers." - Your Assignment: Write a query that returns only the
Name
s of operatives (GTA.Citizens
) who meet both of E-Mage's stringent conditions.
Declassified Solution
SELECT
C.Name AS EliteOperativeCandidate
FROM
GTA.Citizens C
JOIN
GTA.Assignments A ON C.CitizenID = A.CitizenID
JOIN
GTA.Missions M ON A.MissionID = M.MissionID
WHERE
A.Completed = 1 -- Consider only completed missions for earning and count
GROUP BY
C.CitizenID, C.Name
HAVING
COUNT(A.MissionID) >= 2 -- Condition 1: At least 2 completed missions
AND SUM(M.Reward) >= 4000.00; -- Condition 2: At least $4000 earned
Solutions (Bootcamp & Full Training Missions)
(This section contains the expected results for Missions 1-5 of the "Full Training Missions" based on the original OCR'd data. Your results may vary with the expanded dataset.)
MISSION 1: Suspect Scanner
Expected Result:
A list of suspects who have a WantedLevel
of 2 or higher. Example values:
- Chi-neme-rem Agana (Ghostface) β 2
- Marq Alejandro (Firewall) β 2
- Frederick Canning (Freddie Finesse) β 3
- Jakeyl Millan (Beardstorm) β 2
- J Torres (Midnight Mapper) β 2
Total rows expected: 5
MISSION 2: Vehicle Watchlist
Expected Result:
A list showing which suspects have a stolen vehicle, including:
- Remsey Mailjard β Motorcycle, ShadowRider
- Jakeyl Millan β Scooter, Zoomie
- J Torres β Van, StealthWagon
Total rows expected: 3
MISSION 3: Reward Tracker
Expected Result:
Names and total earnings of suspects who completed at least one mission, ordered from highest to lowest earnings. Top examples:
- Claudia Trejo β $6000
- Marq Alejandro β $5000
- Remsey Mailjard β $3000
- Cricelia Prado β $1500
- Chi-neme-rem Agana β $1500
Total rows expected: 5
MISSION 4: Mission Speed Metrics
Expected Result:
Each agent's name, how many missions they completed, and the fastest and slowest time. Example rows:
- Remsey Mailjard β 1 mission β Fastest: 40 min β Slowest: 40 min
- Marq Alejandro β 1 mission β Fastest/Slowest: 60 min
- Cricelia Prado β 1 mission β Fastest/Slowest: 25 min
- Chi-neme-rem Agana β 1 mission β Fastest/Slowest: 20 min
- Claudia Trejo β 1 mission β Fastest/Slowest: 55 min
Total rows expected: 5
MISSION 5: Elite Agent Filter
Expected Result:
Only the suspects who completed at least 2 missions and earned $4000 or more total.
Expected output:
- Claudia Trejo
Total rows expected: 1
(Note: With the "super uitgebreide" dataset and additional assignments previously discussed, more agents like Emilya Illeeva, Lena Petrova, and Remsey Mailjard might also qualify for Mission 5 in your actual database.)
SQL Bay City Blues - Pursuit & Justice (Detective Mega-Challenge)
Handler's Briefing (Detective Challenge)
Detective
(as defined by the
@PlayerOfficerName
variable in the setup SQL, e.g., 'Alex Mercer'), listen up! We've got a Grand Theft Auto, Code 3. Isabelle βIzzyβ Moreau β yes, the tech billionaire, that Izzy Moreau β just had her prized custom Pegassi Vacca (Vehicle ID 121) jacked. This isn't some street punk boosting a sedan; this is a professional hit on a high-value target. The Commissioner's already calling every five minutes.The theft went down last night from her 'impenetrable' penthouse garage in the heart of Rockford Hills. Your case file is live (Incident ID
β this ID was generated when you ran the
GTA_SQL_Academy_with_Bootcamp_met data.sql
script; you might need to queryBCPD_Incidents
to find the exact ID for Moreau's case if you didn't note it. Look for IncidentType 'Grand Theft Auto' reported by CitizenID 25).Your orders are clear: retrieve that vehicle, identify the crew responsible, and bring them down. Bay City PD's reputation β and yours β is on the line.
DATABASE SCHEMA OVERVIEW (Relevant for this challenge)
Table | Purpose | Key Columns |
---|---|---|
GTA.Citizens | Profiles on victims, suspects, witnesses | CitizenID (PK) , Name , Alias , Profession , WantedLevel |
GTA.Vehicles | Details on all vehicles, including the stolen one | VehicleID (PK) , OwnerID (FK) , Type , Brand , IsStolen |
GTA.Properties | Locations of interest, hideouts | PropertyID (PK) , OwnerID (FK) , PropertyName , Location , GarageSlots |
GTA.Factions | Gangs and organizations involved | FactionID (PK) , Name |
GTA.CitizenFactionMembership | Links citizens to factions | CitizenID (FK) , FactionID (FK) , IsActive |
GTA.BCPD_Officers | Your BCPD colleagues and your own profile | OfficerBadgeID (PK) , OfficerName , Rank , Department |
GTA.BCPD_Incidents | Records of reported crimes (your case file) | IncidentID (PK) , ReportedByCitizenID (FK) , ReportingOfficerID (FK) , IncidentType , Location , CurrentStatus |
GTA.BCPD_Suspects_In_Incidents | Links citizens (as suspects) to incidents | IncidentID (FK) , SuspectCitizenID (FK) , InvolvementLevel |
GTA.BCPD_Evidence | Log of all collected evidence for an incident | EvidenceID (PK) , IncidentID (FK) , EvidenceType , Description , LinkedVehicleID (FK) |
GTA.BCPD_Arrests | Records of arrests made | ArrestID (PK) , IncidentID (FK) , ArrestedCitizenID (FK) , ArrestingOfficerID (FK) , ChargesFiled |
PHASE 1: Initial Investigation & Intel Gathering (Detective Challenge)
Your Objective: Gather crucial information to build a picture of the case and potential suspects. Every query is a step closer to cracking this.
β Challenge 1.1 β Confirm Your Identity & Case Assignment (Difficulty: β)
"First things first, Detective. Let's make sure your credentials are in the system and you're officially assigned. We need to know who's running point on this high-stakes operation."
- Task: Write a SQL query to view your official BCPD profile.
- Intel Required: Display all information for your officer from the
GTA.BCPD_Officers
table. - Hint: Use
SELECT *
and filter by yourOfficerBadgeID
(e.g., 778, or the ID you chose/was assigned in the setup script).
Example Query Hint & Expected Result Snippet
SELECT *
FROM GTA.BCPD_Officers
WHERE OfficerBadgeID = 778; -- Replace 778 with your badge ID
Handler's Feedback: "Looks like you're in the system, Detective. Badge ID confirmed. Let's get to work."
You should see your officer's details here.
β Challenge 1.2 β Review the Incident Report Details (Difficulty: β)
"The initial report from Moreau (Citizen ID: 25) just hit your terminal, hot off the press. Every detail matters. Time of occurrence, exact location, initial observations... Scour it for anything out of place."
- Task: Retrieve all details from the incident report concerning the stolen Pegassi Vacca.
- Intel Required: Display all columns for the specific
IncidentID
you noted (or queried) from the briefing.
Example Query Hint & Expected Result Snippet
SELECT *
FROM GTA.BCPD_Incidents
WHERE IncidentID = ; -- Replace with the actual ID (e.g., 1001)
Handler's Feedback: "Standard GTA. The 'no forced entry' and 'advanced security bypassed' bits are interesting. Smells professional."
You'll see the full report: ReportedByCitizenID: 25, ReportingOfficerID: YourBadgeID, IncidentType: 'Grand Theft Auto', Location: 'Rockford Hills Luxury Apartment Garage...', etc.
β Challenge 1.3 β Profile Potential Auto Thieves (Difficulty: ββ)
"This wasn't some joyriding kid, Detective. Moreau's security is state-of-the-art. We need a list of individuals with the skills or the audacity for this kind of job. Pull up records of citizens known for vehicle-related expertise or those already flagged with a significant WantedLevel
. Our thief is likely in this pool."
- Task: Identify citizens who have a
Profession
indicating expertise in car-theft or who have aWantedLevel
β₯ 2. - Intel Required:
CitizenID
,Name
,Alias
,Profession
,WantedLevel
β sorted byWantedLevel
DESC thenProfession
. - Hint: Possible "car theft" professions: 'Escape Vehicle Pro', 'Pro Driver', 'Hustler', 'System Breaker', 'Wheelwoman', 'Gadgeteer'.
Example Query Hint & Expected Result Snippet
SELECT CitizenID, Name, Alias, Profession, WantedLevel
FROM GTA.Citizens
WHERE Profession IN ('Escape Vehicle Pro', 'Pro Driver', 'Hustler', 'System Breaker', 'Wheelwoman', 'Gadgeteer')
OR WantedLevel >= 2
ORDER BY WantedLevel DESC, Profession;
Handler's Feedback: "That's a solid list of potential players. Cross-reference this with known associates of Moreau and any recent activity."
You should see a list including Sofia "Sol" Ramirez, Frederick "Freddie Finesse" Canning, and others.
β Challenge 1.4 β Check for a Pattern β’ Recent High-End Thefts (Difficulty: ββ)
"One high-end car theft is a headline. Two is a trend. Three is a goddamn epidemic. Is this an isolated score, or are we looking at a crew specializing in boosting luxury rides? Check the BCPD stolen vehicle database for any other 'Sports Car' or 'Superbike' types recently reported."
- Task: Display all 'Sports Car' and 'Superbike' vehicles currently listed as stolen (
IsStolen = 1
). Include the owner's name. - Intel Required:
V.VehicleID
,C.Name AS OwnerName
,V.Brand
,V.Type
.
Example Query Hint & Expected Result Snippet
SELECT
V.VehicleID,
C.Name AS OwnerName,
V.Brand,
V.Type,
V.IsStolen
FROM GTA.Vehicles V
LEFT JOIN GTA.Citizens C ON V.OwnerID = C.CitizenID
WHERE V.IsStolen = 1
AND V.Type IN ('Sports Car', 'Superbike');
Handler's Feedback: "The Pegassi Vacca (ID 121) should be on this list. If there are others, note the MO. Any connections?"
You should see the Vacca and any other high-end stolen vehicles from your dataset.
PHASE 2: Evidence Collection & Witness Intel (Detective Challenge)
Your Objective: Analyze available evidence and witness information to narrow down your suspect list. The devil is in the details.
β Challenge 2.1 β Review CCTV Footage Log (Difficulty: β)
"Forensics just sent over their initial analysis of the CCTV footage from Moreau's garage. It's grainy, as always, but there might be something. Pull up the official evidence log for this case."
- Task: Display the evidence record with
EvidenceType = 'CCTV Footage'
linked to the stolen-Vacca incident. - Intel Required: All columns from the relevant
GTA.BCPD_Evidence
record.
Example Query Hint & Expected Result Snippet
SELECT *
FROM GTA.BCPD_Evidence
WHERE IncidentID = -- Replace with your ID
AND EvidenceType = 'CCTV Footage';
Handler's Feedback: "'Figure in dark clothing, medium build, plate obscured.' Standard. But 'keypad disabled quickly' points to someone who knew the system or is very good with electronics."
The description of the CCTV footage should provide some clues.
β Challenge 2.2 β Identify βPersons of Interestβ (Difficulty: ββ)
"Moreau wasn't entirely unhelpful. She dropped a couple of names β individuals who've been sniffing around her assets, showing a little too much interest in her Vacca. Check the case file (BCPD_Suspects_In_Incidents
) to see who your reporting officer officially flagged as 'Persons of Interest' based on her statement."
- Task: Display all suspects linked to the stolen-Vacca
IncidentID
. - Intel Required:
SuspectName
,SuspectAlias
,InvolvementLevel
,SII.Notes
. - Hint: The setup script should have added Frederick "Freddie Finesse" Canning (ID 7) and Sofia "Sol" Ramirez (ID 23).
Example Query Hint & Expected Result Snippet
SELECT
S.Name AS SuspectName,
S.Alias AS SuspectAlias,
SII.InvolvementLevel,
SII.Notes
FROM GTA.BCPD_Suspects_In_Incidents SII
JOIN GTA.Citizens S
ON SII.SuspectCitizenID = S.CitizenID
WHERE SII.IncidentID = ; -- Replace with your ID
Handler's Feedback: "Finesse and Ramirez. Not surprised. Both have the connections and the nerve. Let's dig into them."
You should see Freddie and Sol listed with notes about their potential connection.
β Challenge 2.3 β Background Check β’ Vehicles & Hideouts of Key Suspects (Difficulty: βββ)
"Alright, Detective, our 'Persons of Interest' are Freddie Finesse (CitizenID 7) and Sol Ramirez (CitizenID 23). Let's run a background check on their known assets. What kind of wheels are they rolling in? Could they have used their own rides for reconnaissance or as a chase car? And more importantly, do they have properties with enough GarageSlots
to make a Pegassi Vacca disappear?"
Part A β Vehicles
- Task: List all vehicles owned by Sofia βSolβ Ramirez and Frederick βFreddie Finesseβ Canning.
- Intel:
OwnerName
,Type
,Brand
,Speed
.
Part B β Properties
- Task: List all properties owned by the same two suspects, paying special attention to
GarageSlots
. - Intel:
OwnerName
,PropertyName
,PropertyType
,Location
,GarageSlots
.
Example Query Hint (A β Vehicles) & Expected Result Snippet
SELECT
C.Name AS OwnerName,
V.Type,
V.Brand,
V.Speed
FROM GTA.Citizens C
JOIN GTA.Vehicles V
ON C.CitizenID = V.OwnerID
WHERE C.CitizenID IN (7, 23) -- For Freddie and Sol
ORDER BY C.Name, V.Speed DESC;
Handler's Feedback (Vehicles): "Sol's got that 'Sultan RS' β fast and tunable. Freddie's 'Manana' is more for cruising, less for heists. Interesting."
Example Query Hint (B β Properties) & Expected Result Snippet
SELECT
C.Name AS OwnerName,
P.PropertyName,
P.PropertyType,
P.Location,
P.GarageSlots
FROM GTA.Citizens C
JOIN GTA.Properties P
ON C.CitizenID = P.OwnerID
WHERE C.CitizenID IN (7, 23)
ORDER BY C.Name, P.GarageSlots DESC;
Handler's Feedback (Properties): "Freddie's pad in East LS only has one slot. Sol, though... 'Sol's Waterfront Hideout' has 5. That's more like it for stashing something valuable."
Pro Tip: Using
IN (value1, value2, ...)
is a concise way to filter a column against multiple possible values, often more readable than multipleOR
conditions.
PHASE 3: Closing In β The Takedown (Detective Challenge)
Handler's Update (Encrypted Channel): "Detective, solid gold from one of my CIs! The chatter on the street points directly to Sofia βSolβ Ramirez (Citizen 23). Word is she's the wheelwoman and the brains behind this. My source says she's got the Vacca cooled off in a warehouse controlled by her crew, the Street Racers Syndicate (Faction ID: 510), down at the Port of Bay City. This is our best lead. Verify it, locate that warehouse, and let's bring this car β and Ramirez β home."
β Challenge 3.1 β Locate Faction Hideouts & Suspect Lairs (Difficulty: ββββ)
"The informant was clear: Port of Bay City. We need to pinpoint that warehouse. Check properties directly owned by Sol Ramirez in that area. Also, run a broader search for any properties in the port linked to active members of the Street Racers Syndicate. One of them has to be our spot."
Part 1 β Solβs direct properties in the port
Find properties owned by Sol Ramirez located near βPort of Bay Cityβ.
Part 2 β Properties of active Street Racers Syndicate members in the port
Find properties owned by active members of Faction 510 located near the port. This is a tougher query!
Example Query Hint (Part 1) & Expected Result Snippet
SELECT
C.Name AS OwnerName,
P.PropertyName,
P.PropertyType,
P.Location,
P.GarageSlots
FROM GTA.Properties P
JOIN GTA.Citizens C
ON P.OwnerID = C.CitizenID
WHERE P.OwnerID = 23 -- Sol Ramirez
AND P.Location LIKE '%Port of Bay City%';
Intel Unlocked: This should point you to "Sol's Waterfront Hideout (SRS Used)" if the setup data is correct.
Example Query Hint (Part 2) & Expected Result Snippet
SELECT DISTINCT -- Avoids listing the same property multiple times if multiple members are linked to it
C_Owner.Name AS PropertyOwner,
P.PropertyName,
P.PropertyType,
P.Location,
P.GarageSlots,
C_Member_Alias.Alias AS FactionMemberAssociated, -- Shows who in the faction is linked to the owner
F.Name AS FactionName
FROM GTA.Properties P
JOIN GTA.Citizens C_Owner ON P.OwnerID = C_Owner.CitizenID -- Get property owner details
JOIN GTA.CitizenFactionMembership CFM ON C_Owner.CitizenID = CFM.CitizenID -- Link owner to their faction memberships
JOIN GTA.Factions F ON CFM.FactionID = F.FactionID -- Get faction details
JOIN GTA.Citizens C_Member_Alias ON CFM.CitizenID = C_Member_Alias.CitizenID -- Get details of the faction member (who is the owner here)
WHERE F.FactionID = 510 -- Street Racers Syndicate
AND CFM.IsActive = 1
AND P.Location LIKE '%Port of Bay City%';
Handler's Feedback: "Both queries point to Sol's warehouse at Pier 7. The informant was good. Looks like Sol is using her own property as the Syndicate's chop shop or temporary stash."
Handler's Update (Priority Channel): "Units on standby near Pier 7. We have eyes on a warehouse matching the description: 'Solβs Waterfront Hideout (SRS Used)' (should be PropertyID 407 from your setup). Thermal imaging confirms a vehicle matching the Vacca's profile inside. This is it, Detective. Go time. But first, paperwork β log that car as recovered evidence before the tac team breaches."
β Challenge 3.2 β Log the Recovered Vehicle as Evidence (Difficulty: ββ)
"The SWAT team is ready to breach, but protocol is protocol. The recovered Pegassi Vacca (VehicleID: 121) needs to be officially logged as evidence before it's moved. Update the BCPD evidence database now."
- Task: Insert a new record into
GTA.BCPD_Evidence
. - Details for INSERT:
IncidentID =
,CollectedByOfficerID =
,EvidenceType = 'Vehicle'
,Description = "Recovered stolen red Pegassi Vacca, VIN matches victim's vehicle. Found inside warehouse at Pier 7. Minor scratches on passenger side door."
,DateTimeCollected = GETDATE()
,LocationFound = "Sol's Waterfront Hideout (SRS Used), Pier 7, Port of Bay City"
,LinkedVehicleID = 121
.
Example INSERT & Handler's Feedback
INSERT INTO GTA.BCPD_Evidence
(IncidentID, CollectedByOfficerID, EvidenceType, Description,
DateTimeCollected, LocationFound, LinkedVehicleID)
VALUES
(, -- Replace with your ID
, -- Replace with your ID
'Vehicle',
'Recovered stolen red Pegassi Vacca, VIN matches victim''s vehicle. Found inside warehouse at Pier 7. Minor scratches on passenger side door.',
GETDATE(),
'Sol''s Waterfront Hideout (SRS Used), Pier 7, Port of Bay City',
121);
Handler's Feedback: "Evidence logged. Green light for the tac team. Stand by for sitrep."
β Challenge 3.3 β Make the Arrest & Close the Case (Difficulty: βββ)
"SWAT breached. Suspect Sofia 'Sol' Ramirez (CitizenID: 23) apprehended inside the warehouse, practically sitting on the hood of the Vacca. She didn't go quietly, but she's in cuffs. It's time to process her, update the case file, and inform the Commissioner we got our car back."
Part A β Arrest
- Task: Insert an arrest record for Sofia Ramirez (Citizen 23).
- Details for INSERT:
IncidentID =
,ArrestedCitizenID = 23
,ArrestingOfficerID =
,DateTimeArrested = GETDATE()
,LocationOfArrest = "Sol's Waterfront Hideout..."
,ChargesFiled = "Grand Theft Auto (Sec 487 PC), Possession of Stolen Property (Sec 496 PC)"
,BookingNotes = "Suspect apprehended at scene with stolen vehicle. Resisted initially but subdued without further incident. Vehicle recovered."
.
Part B β Close Incident
- Task: Update
GTA.BCPD_Incidents.CurrentStatus
to'Closed β Arrest'
.
Part C β (Bonus) Update Wanted Level
- Task: Set Sofiaβs
WantedLevel
inGTA.Citizens
to 4.
Example SQL & Expected Outcome
-- A: Arrest record
INSERT INTO GTA.BCPD_Arrests
(IncidentID, ArrestedCitizenID, ArrestingOfficerID,
DateTimeArrested, LocationOfArrest, ChargesFiled, BookingNotes)
VALUES
(, -- Replace with your ID
23, -- Sofia "Sol" Ramirez
, -- Replace with your ID
GETDATE(),
'Sol''s Waterfront Hideout (SRS Used), Pier 7, Port of Bay City',
'Grand Theft Auto (Sec 487 PC), Possession of Stolen Property (Sec 496 PC)',
'Suspect apprehended at scene with stolen vehicle. Resisted initially but subdued without further incident. Vehicle recovered.');
-- B: Close the incident
UPDATE GTA.BCPD_Incidents
SET CurrentStatus = 'Closed - Arrest'
WHERE IncidentID = ; -- Replace with your ID
-- C: Bonus β increase wanted level
UPDATE GTA.Citizens
SET WantedLevel = 4
WHERE CitizenID = 23; -- Sofia "Sol" Ramirez
Handler's Feedback: "Paperwork filed, suspect processed, wanted level updated. Nicely done, Detective."
Handler's Commendation
Excellent work, Detective
! The Pegassi Vacca is back with its rightful owner, Ms. Moreau is ecstatic, and Sol Ramirez is facing serious time. The Commissioner sends his regards β said you handled this like a seasoned pro. Bay City is a little safer tonight thanks to you. Case closed!