Branchwell

AI Resource Pro / website / scripts / column-check.sql

1-- SQL to check which columns exist in the categories table
2-- Run this first to confirm what columns are available
3
4-- Check table structure
5SELECT
6 column_name,
7 data_type,
8 is_nullable
9FROM
10 information_schema.columns
11WHERE
12 table_schema = 'public'
13 AND table_name = 'categories'
14ORDER BY
15 ordinal_position;
16
17-- Count how many categories exist
18SELECT COUNT(*) AS total_categories FROM categories;
19
20-- Sample a few rows to see current data
21SELECT
22 id, name, instance_count, created_at, updated_at
23FROM
24 categories
25ORDER BY
26 name
27LIMIT 5;