AI Buddies πŸ€–

Jouw digitale maatje op maat

GTA:SQL BAY CITY CHALLENGE

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

  1. GTA: SQL Bay City Hustle – Bay City SQL Bootcamp
  2. SQL Operations: Full Training Missions
  3. SQL Bay City Blues - Pursuit & Justice (Detective Mega-Challenge)
  4. SQL Login Credentials & Recommended Tools
  5. Final System Message

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.


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:

  1. 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:
      1. Open Azure Data Studio.
      2. Click "New Connection" or the plug icon in the SERVERS view.
      3. Connection type: Microsoft SQL Server.
      4. Server: skills4it.database.windows.net
      5. Authentication type: SQL Login.
      6. User name: gtareader
      7. Password: StrongPass!2025
      8. Database: Courses (or leave as and select later).
      9. Enable "Encrypt connection" (usually default and recommended).
      10. Consider enabling "Trust server certificate" if you encounter SSL issues for initial local connections, but for production, properly configured certificates are better.
      11. Click "Connect".
  2. 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:
      1. Open SSMS.
      2. Server type: Database Engine.
      3. Server name: skills4it.database.windows.net
      4. Authentication: SQL Server Authentication.
      5. Login: gtareader
      6. Password: StrongPass!2025
      7. Click "Connect".
      8. You might need to click "Options >>" and specify "Connect to database:" as Courses on the "Connection Properties" tab. Ensure "Encrypt connection" is checked.
  3. 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
  4. 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 or Cmd+Shift+P) to "MS SQL: Connect" and follow the prompts similar to Azure Data Studio.

General Connection Steps (varies slightly by tool):

  1. Open your chosen tool.
  2. Find "New Connection" / "Connect to Server".
  3. Server Name/Host: skills4it.database.windows.net
  4. Authentication Type: "SQL Server Authentication".
  5. Login/User name: gtareader
  6. Password: StrongPass!2025
  7. Database (Optional but Recommended): Courses.
  8. Encryption: Ensure it's enabled. For Azure SQL, this is typically required.
  9. 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:


GTA: SQL Bay City Hustle – Bay City SQL Bootcamp

πŸ’» SYSTEM MESSAGE: Incoming Transmission... Decrypting... Welcome, Agent.

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.CitizensProfiles: Targets, Assets, InformantsCitizenID (PK), Name, Alias, Profession, WantedLevel
GTA.VehiclesTransport: Getaway Cars, Stolen Goods, AssetsVehicleID (PK), OwnerID (FK), Type, Brand, Speed, IsStolen
GTA.MissionsOps: Contracts, Heists, Covert JobsMissionID (PK), Title, Difficulty, Reward, Location
GTA.AssignmentsOperative Activity: Links Citizens to MissionsCitizenID (FK), MissionID (FK), Completed, TimeSpent
GTA.WeaponsArsenal: Tools of the TradeWeaponID (PK), Name, Type, DamagePerShot, Price
GTA.CitizenWeaponsLoadouts: Who's carrying whatCitizenID (FK), WeaponID (FK), IsEquipped
GTA.PropertiesReal Estate: Safehouses, Fronts, LairsPropertyID (PK), OwnerID (FK), PropertyName, PropertyType, MarketValue, GarageSlots
GTA.FactionsOrganizations: Gangs, Corps, Secret SocietiesFactionID (PK), Name, LeaderID (FK), Turf, DefaultRelation
GTA.CitizenFactionMembershipAllegiances: Who's in with whomCitizenID (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: ⭐)

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: ⭐)

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: ⭐⭐)

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: ⭐⭐)

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."

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: ⭐)

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

Declassified Solution
SELECT Name, Alias, WantedLevel
FROM GTA.Citizens
WHERE WantedLevel >= 2;

MISSION 2: Vehicle Watchlist

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

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

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

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:

Total rows expected: 5

MISSION 2: Vehicle Watchlist

Expected Result:
A list showing which suspects have a stolen vehicle, including:

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:

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:

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:

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)

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•— β•šβ•β•β•β•β–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘ β•šβ•β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•

πŸš“ SYSTEM MESSAGE: Badge #, a priority call just came in. High alert! This is not a drill.

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 query BCPD_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.CitizensProfiles on victims, suspects, witnessesCitizenID (PK), Name, Alias, Profession, WantedLevel
GTA.VehiclesDetails on all vehicles, including the stolen oneVehicleID (PK), OwnerID (FK), Type, Brand, IsStolen
GTA.PropertiesLocations of interest, hideoutsPropertyID (PK), OwnerID (FK), PropertyName, Location, GarageSlots
GTA.FactionsGangs and organizations involvedFactionID (PK), Name
GTA.CitizenFactionMembershipLinks citizens to factionsCitizenID (FK), FactionID (FK), IsActive
GTA.BCPD_OfficersYour BCPD colleagues and your own profileOfficerBadgeID (PK), OfficerName, Rank, Department
GTA.BCPD_IncidentsRecords of reported crimes (your case file)IncidentID (PK), ReportedByCitizenID (FK), ReportingOfficerID (FK), IncidentType, Location, CurrentStatus
GTA.BCPD_Suspects_In_IncidentsLinks citizens (as suspects) to incidentsIncidentID (FK), SuspectCitizenID (FK), InvolvementLevel
GTA.BCPD_EvidenceLog of all collected evidence for an incidentEvidenceID (PK), IncidentID (FK), EvidenceType, Description, LinkedVehicleID (FK)
GTA.BCPD_ArrestsRecords of arrests madeArrestID (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."

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."

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."

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."

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."

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."

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

Part B – Properties

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 multiple OR 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."

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

Part B – Close Incident

Part C – (Bonus) Update Wanted Level

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!

SYSTEM MESSAGE: Case File # – Status: CLOSED. Commendation Awarded. Reputation Increased.


FINAL SYSTEM MESSAGE

Agent, you've been equipped with the fundamental and advanced SQL directives necessary to operate effectively in Bay City. The preceding bootcamp and training missions were designed to forge your data extraction skills. The "Bay City Blues" mega-challenge is your final exam. Remember, in this city, the ones who can read the data control the narrative. Don't just query the data; interrogate it. Make it talk. Your success, and perhaps your survival, depends on it.

End of Transmission.